כמה עוד נשאר למשלוח חינם גם לעגלה ולצקאאוט

PHOTO EMBED

Fri May 14 2021 07:06:39 GMT+0000 (Coordinated Universal Time)

Saved by @Shesek #checkout #cart #delivery

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' );
   }
  
}
content_copyCOPY

קרדיט: שמעון סביר