WooCommerce getting the selected attributes of the product attribute on a single product page

by Dmitriy Olhovsky   Last Updated January 12, 2018 21:08 PM

I need to change price of variable product that depends of selected options (attributes values) by the user. And I need to do this immediately after user select attribute value on single product page.

I tried to do this using hooks "woocommerce_product_variation_get_price" and "raw_woocommerce_price". And I tried to get attributes values using methods "get_attributes", "get_available_variations" etc. But I getted only list of all attributes with all possible values. But I need to get attributes and their values currently selected by user on the product page.

Right now I don't find any possible solution using woocommerce functions. And if I don't find it - I have a idea to store selected values in session variables (on frontend) and access it from the backend. But I understand that this is not best solution :)

Suggest on any solutions, thanks, best regards.



Related Questions


Wocommerce Variation Product ajax add to cart

Updated April 07, 2015 20:03 PM



Woocomerce paypal payment successfull hook

Updated September 17, 2016 09:03 AM

WooCommerce and do_action hooks

Updated July 27, 2015 14:03 PM


Cache file /home/queryxchang/questarter.com/apps/frontend/config/../cache/-q-woocommerce-getting-the-selected-attributes-of-the-product-attribute-on-a-single-product-page-9-290941-html could not be written