Created
March 3, 2023 22:13
-
-
Save jjmontalban/cd3faccd96852c19d2d180e260d89ff2 to your computer and use it in GitHub Desktop.
Importe de pedido minimo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @snippet Minimum Order Amount | |
* @author JJMontalban | |
*/ | |
//woocommerce_check_cart_items will give the customer an warning when reaching the checkout unless purchase requirement is met. | |
add_action( 'woocommerce_check_cart_items', 'jj_minimum_order_amount' ); | |
add_action( 'woocommerce_before_cart', 'jj_minimum_order_amount' ); | |
function jj_minimum_order_amount() { | |
$minimum = 30; // change this to your minimum order amount | |
if ( WC()->cart->subtotal < $minimum ) { | |
if ( is_cart() ) { | |
wc_print_notice( | |
sprintf( 'Debe hacer un pedido mínimo de %s para finalizar su pedido. Su pedido actual es de %s.' , wc_price( $minimum ), wc_price( WC()->cart->subtotal ) ), 'error' ); | |
} else { | |
wc_add_notice( | |
sprintf( 'Debe hacer un pedido mínimo de %s para finalizar su pedido. Su pedido actual es de %s.' , wc_price( $minimum ), wc_price( WC()->cart->subtotal ) ), 'error' ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment