This topic contains 2 reply and 3 voices, and was last updated by pixeledmedia 6 years, 1 month ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
September 8, 2014 at 8:40 pm 26486
pixeledmedia Hi I was wondering what I can do so a user can only purchase from one store?
September 8, 2014 at 9:14 pm 26489
Mike Mike

Can you give an example?

September 9, 2014 at 4:02 am 26499
pixeledmedia pixeledmedia

Hey Edward, use this code (put in functions.php):

add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' );

function woo_custom_add_to_cart( $cart_item_data ) {

    global $woocommerce;
    $woocommerce->cart->empty_cart();

    // Do nothing with the data and return
    return $cart_item_data;
}

It allows the cart to only be updated with 1 product at a time, therefore meaning that a user can only purchase from one store at a time.

Viewing 2 Posts - 1 through 2 (of 2 total)