R
R
ragderman2020-05-01 21:09:34
WordPress
ragderman, 2020-05-01 21:09:34

WooCommerce. How to add a product with multiple variations to the cart?

example: $woocommerce->cart->add_to_cart( $product_id = 2960, $quantity = 1, $variation_id = 2961, $variation = array(), $cart_item_data = array() );

There is a product it has a size variation. In this example, $variation_id. Everything is working. The item goes into the cart.
And if there is another color variation, then how to add the product to the cart in this case. I assume that you need to add something to this $variation array. But I can’t find what to add there, and what will be in the $variation_id variable then. Can you also tell me how to get the id of all variations on the product page?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lev Rozanov, 2020-05-01
@MetisKot

Quick Bulk Variations Checkout for WooCommerce

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question