Woocommerce Add Variation Product to Cart from custom link [closed]
IT Nursery
April 12, 2022
0
I am trying to add a variation product to my cart directly through a link. I am setting the variation_id with the query string. As far as I can tell I am sending the data the exact same way as the default variation product form does.
Conversely, the simple product works fine. I have set prices to my product variations in the admin. Not sure why it’s not as simple as sending the data through. Any help would greatly appreciated.
2
i currently work on a woocommerce v2.1.12 shop and it seems they chaged that behavior.
my ajax url to add items to the cart has to look like this:
this adds a specific product to the cart and also sets the variation attributes in the cart.
you can even set the quantity by simply adding &quantity=[VALUE]
in the end this comes in handy since all these values are set inside the submit form / select fields, you just have to look those up..