Skip to content

Instantly share code, notes, and snippets.

@sulfo
Forked from jukra/functions.php
Created November 19, 2015 19:47

Revisions

  1. @jukra jukra created this gist Aug 7, 2015.
    10 changes: 10 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    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' );