Home Forums Theme Support Dokan Purchase from one Store Only

This topic is: resolved

This topic contains 2 replies, has 3 voices, and was last updated by  pixeledmedia 4 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26486

    Edward
    Member
    Post count: 10

    Hi I was wondering what I can do so a user can only purchase from one store?

    #26489

    Mike
    Member
    Post count: 56

    Can you give an example?

    #26499

    pixeledmedia
    Participant
    Post count: 18

    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 3 posts - 1 through 3 (of 3 total)

The topic ‘Purchase from one Store Only’ is closed to new replies.