woocommerce的变化 [英] woocommerce variations
问题描述
我正在创建woocommerce主题,并且我有产品变体,即在产品详细信息页面上显示的尺寸,但是问题是我想通过使用产品ID在自定义php页面中获得所有变体,任何人都可以帮我吗.
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.
谢谢.
推荐答案
您可以使用:$available_variations = $product->get_available_variations();
如果这是一个样式模板,请确保在顶部附近添加global $product;
.
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.
这篇关于woocommerce的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!