add_action( 'woocommerce_before_cart', 'calculator_free_shipping_cart_notice' ); function calculator_free_shipping_cart_notice() { $min_amount = 350; //change this to your free shipping threshold $current = WC()->cart->subtotal; if ( $current < $min_amount ) { $added_text = ' עוד ' . wc_price( $min_amount - $current ) . ' ויש לכם שליח עד הבית בחינם!'; $return_to = wc_get_page_permalink( 'home' ); $notice = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), 'הוסיפו פריטים לסל למשלוח חינם', $added_text ); wc_print_notice( $notice, 'notice' ); } } add_action( 'woocommerce_before_checkout_form', 'free_shipping_cart_notice' ); function free_shipping_cart_notice() { $min_amount = 350; //change this to your free shipping threshold $current = WC()->cart->subtotal; if ( $current < $min_amount ) { $added_text = ' עוד ' . wc_price( $min_amount - $current ) . ' ויש לכם שליח עד הבית בחינם!'; $return_to = wc_get_page_permalink( 'home' ); $notice = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), 'הוסיפו פריטים לסל למשלוח חינם', $added_text ); wc_print_notice( $notice, 'notice' ); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter