Senza categoria

WooCommerce – Soglia spedizione gratuita

add_action('woocommerce_before_cart_totals', 'notifica_spedizione_gratuita_carrello');

 add_action('woocommerce_checkout_before_order_review', 'notifica_spedizione_gratuita_checkout');
 

		function notifica_spedizione_gratuita_carrello() {
		
				global $woocommerce;
				 
				 if (is_cart()){
				
				$soglia = '60.00';   //soglia spedizione gratuita
				 
				$subtotale = WC()->cart->subtotal;
				
					if ($subtotale > $soglia){
							
						} else {
					
						echo '
									<div class="alert-carrello-spedizione" id="stickyform2-head-carrello">
									<div class="text" style="color:#ffffff;font-size:12px;"><span style="font-size: 18px; font-weight: 700;">MANCANO SOLO <span class="prezzo_rimanente">'. wc_price( $soglia - $subtotale ) .'</span> PER RICEVERE GRATIS I TUOI VINI!</span>
									</div>
									</div>
										';
						 
								}	 
						}
		}




		function notifica_spedizione_gratuita_checkout() {
		
				global $woocommerce;
				 
				 if (is_checkout()){
				
				$soglia = '60.00';   //soglia spedizione gratuita
				 
				$subtotale = WC()->cart->subtotal;
				
					if ($subtotale > $soglia){
							
						} else {
					
						echo '
									<div class="alert-carrello-spedizione" id="stickyform2-head-carrello">
									<div class="text" style="color:#ffffff;font-size:12px;"><span style="font-size: 18px; font-weight: 700;">MANCANO SOLO <span class="prezzo_rimanente">'. wc_price( $soglia - $subtotale ) .'</span> PER RICEVERE GRATIS I TUOI VINI!</span>
									</div>
									</div>
										';
						 
								}	 
						}
		}