Я бы хотел, чтобы цена блокировала конкретную категорию WooCommerce, теперь работаю только во всех категории WooCommerce My Code. Моя категория называется: Stock. Я хочу использовать только для этой категории. < /P>
Я хочу, чтобы пользователь был пользователем, если категория покупки должна купить минимум 1200. < /P>
// Set a minimum dollar amount per order
add_action( 'woocommerce_check_cart_items', 'spyr_set_min_total' );
function spyr_set_min_total() {
// Only run in the Cart or Checkout pages
if( is_cart() || is_checkout() ) {
global $woocommerce;
// Set minimum cart total
$minimum_cart_total = 1200;
// Total we are going to be using for the Math
// This is before taxes and shipping charges
$total = WC()->cart->subtotal;
// Compare values and add an error is Cart's total
// happens to be less than the minimum required before checking out.
// Will display a message along the lines of
// A Minimum of 10 USD is required before checking out. (Cont. below)
// Current cart total: 6 USD
if( $total
Подробнее здесь: https://stackoverflow.com/questions/277 ... nimum-cart