2

I am trying to add variable products to cart using woocommerce via ajax.I am following the option where I call query string http://xxx/cart/?add-to-cart=PRODUCT_ID&variation_id=VARIATION_ID&attribute_pa_colour=ATTRIBUTE_SLUG.

I am able to dynamically pass the product id using $product->id. But I am clueless as to how I will get the variation id and selected attribute value. I tried using $post_id = $variation->ID but its not working. Kindly Help.I am using a plugin to display the variation and swatches.

Vidhya Moorthy
  • 89
  • 1
  • 2
  • 6

0 Answers0