Created
April 18, 2017 17:54
-
-
Save attilabacso/ffb2cc7811c0512cc3f153cbd88c5bff 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
<?php | |
//Set minimum order amount | |
function minimum_order_func(){ | |
global $woocommerce; | |
if (is_checkout()){ | |
$minorder = 1500; | |
// If the cart is empty and the order_total less than $minorder (1500) | |
if ( ($woocommerce->cart->subtotal < $minorder) && (WC()->cart->get_cart_contents_count() <> 0)){ | |
wc_add_notice( sprintf(__('Sorry, you have not met the minimum order amount of ' .$minorder.' HUF'), 'woocommerce'), 'error' ); | |
wp_redirect( get_permalink( woocommerce_get_page_id( 'cart' ) ) ); | |
exit; | |
} | |
} | |
} | |
add_action('the_post','minimum_order_func',10); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment