woocommerce variations

Sachin Magar picture Sachin Magar · Nov 20, 2012 · Viewed 70.2k times · Source

I am creating a woocommerce theme and I have product variations i.e. size which is displayed on product details page but problem is that I want to get all variations in my custom php page by using product id, can any one help me.

Thanks in advance.

Answer

Shawn Wernig picture Shawn Wernig · Nov 20, 2012

You can use: $available_variations = $product->get_available_variations();

If this is a single style template, make sure you add global $product; near the top.

From there, you can foreach through the variations and do as you wish... since you didn't have any specific output I hope that this sets you on the right track.