Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WooCommerce remaining cost for free shipping notification
function cart_notice() {
$free_shipping_settings = get_option( 'woocommerce_free_shipping_settings' );
$maximum = $free_shipping_settings['min_amount'];
$current = WC()->cart->subtotal;
if ( $current < $maximum ) {
echo '<div class="woocommerce-message">Get free shipping if you order $ ' . ($maximum - $current) . ' more!</div>';
add_action( 'woocommerce_before_cart', 'cart_notice' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.