Snippets Collections
// Move Coupon Code To Order Review
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
add_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_coupon_form', 5 );
// Set a minimum dollar amount per order
add_action( 'woocommerce_check_cart_items', 'spyr_set_min_total' );
function spyr_set_min_total() {
	// Only run in the Cart or Checkout pages
	if( is_cart() || is_checkout() ) {
		global $woocommerce;

		// Set minimum cart total
		$minimum_cart_total = 500;

		// Total we are going to be using for the Math
		// This is before taxes and shipping charges
		$total = WC()->cart->subtotal;
		
		// Compare values and add an error is Cart's total
	    // happens to be less than the minimum required before checking out.
		// Will display a message along the lines of
		// A Minimum of 10 USD is required before checking out. (Cont. below)
		if( $total <= $minimum_cart_total  ) {
			// Display our error message
			wc_add_notice( sprintf( '<strong>A Minimum of %s %s is required before checking out.</strong>'
				.'<br />Current cart\'s total: %s %s',
				$minimum_cart_total,
				get_option( 'woocommerce_currency'),
				$total,
				get_option( 'woocommerce_currency') ),
			'error' );
		}
	}
}
add_action( 'woocommerce_before_cart', 'computec_shipping_cart_notice' );
  
function computec_shipping_cart_notice() {
  
   $min_amount = 150; //change this to your shipping threshold
   
   $current = WC()->cart->subtotal;
  
   if ( $current < $min_amount ) {

	$added_text = ' אנו מבצעים משלוחים מסכום של 150 ש"ח ומעלה הוסף מוצרים בסך ' . wc_price( $min_amount - $current ) . ' נוספים!';       
	$return_to = wc_get_page_permalink( 'shop' );
	$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_cart', 'bbloomer_free_shipping_cart_notice' );
  
function bbloomer_free_shipping_cart_notice() {
  
   $min_amount = 350; //change this to your free shipping threshold
   
   $current = WC()->cart->subtotal;
  
   if ( $current < $min_amount ) {
$added_text = ' בכדי לקבל משלוח חינם עליך לרכוש בסכום מעל 350 ש"ח הוסף מוצרים בסך ' . wc_price( $min_amount - $current ) . ' נוספים!';      $return_to = wc_get_page_permalink( 'shop' );
      $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_after_cart', 'seger_notice_cart_hodula' );
 
function seger_notice_cart_hodula() {
echo '
<style>
p.notice-seger-cart{
	background-color:#f1f1f1!important;
	font-size:16px;
	border:1px solid #eee;
	display: block;
    padding: 20px;
	color:black;
	box-shadow:2px 2px 2px grey;
	margin-top:20px;
}
</style>
<p class="notice-seger-cart"><b style="font-size:18px;">שימי לב 💗</b><br>
בעקבות הסגר החלטנו לספסד את מחיר שירות המשלוחים עד הבית ל<u>20 ₪ בלבד.</u>
</p>';
}
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' );
   }
  
}

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension