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
<?php | |
add_action( 'woocommerce_after_checkout_validation', 'mgris_minimum_order', 10, 2); | |
function mgris_minimum_order( $fields, $errors ) { | |
global $woocommerce; | |
// Modifier la variable $minorder par votre montant minimum. | |
$minorder = 25; | |
$panier = $woocommerce->cart->subtotal; | |
if($panier < $minorder) { | |
$errors->add( 'validation', sprintf(__('Désolé, pour pouvoir réaliser une commande en ligne, le montant de votre panier doit être supérieur à <strong>' . $minorder . '</strong> €. <br /><a href="%s">Retour à la boutique →</a><br />', 'textdomain'), get_permalink( wc_get_page_id('shop') ) ) ); |