Created
March 21, 2017 20:31
-
-
Save brandalismo/2403bc4b6fb26892b0fb79681676fcdc to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
* HABILITAR CANTIDAD MÍNIMA DE PEDIDO | |
*/ | |
function woo_minimum_order_amount() { | |
$minimum = 10; //Establecer importe mínimo de compra | |
if ( WC()->cart->total < $minimum ) { | |
if( is_cart() ) { | |
wc_print_notice( | |
sprintf( 'Debes realizar un pedido mínimo de %s para finalizar tu compra.' , // Personalizar | |
wc_price( $minimum ), | |
wc_price( WC()->cart->total ) | |
), 'error' | |
); | |
} else { | |
wc_add_notice( | |
sprintf( 'Debes realizar un pedido mínimo de %s para finalizar tu compra.' , // Personalizar | |
wc_price( $minimum ), | |
wc_price( WC()->cart->total ) | |
), 'error' | |
); | |
} | |
} | |
} | |
add_action( 'woocommerce_checkout_process', 'woo_minimum_order_amount' ); | |
add_action( 'woocommerce_before_cart' , 'woo_minimum_order_amount' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment