"Free Shipping Over X" Note on Product Pages
Shows a small free-shipping reminder under the price on product pages, with the threshold taken from your settings, to nudge bigger orders.
Opens WPIDE on
Code
$wpide_ship_note = array(
'threshold' => 50, // Free shipping threshold.
'text' => 'Free shipping on orders over %s', // %s = threshold.
);
add_action( 'woocommerce_single_product_summary', function () use ( $wpide_ship_note ) {
global $product;
if ( ! $product instanceof WC_Product || ! $product->needs_shipping() ) {
return;
}
printf( '<p class="wpide-ship-note">%s</p>', wp_kses_post( sprintf( esc_html( $wpide_ship_note['text'] ), wc_price( $wpide_ship_note['threshold'] ) ) ) );
}, 11 );
Notes
Hidden on virtual and downloadable products; change the wording in $wpide_ship_note.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.