taxonomie children wordpress woocommerce product_variation

时间:2018-01-12 05:40:28

标签: php wordpress woocommerce taxonomy-terms

我的问题是让WooCommerce / Wordpress中的变异孩子。

应该有(WooDocs)分类产品变量但这会失败......

$term_children = get_terms('product_variation',$term_id);

使用:

$variation_ids = wc_get_attribute_taxonomies();

我获得了第一个变体级别,我想可以为get_terms获取每个attribute_id的$ term_id ...

来自$ variation_ids的输出:

Array
(
[0] => stdClass Object
    (
        [attribute_id] => 1
        [attribute_name] => aufzucht
        [attribute_label] => Aufzucht
        [attribute_type] => select
        [attribute_orderby] => menu_order
        [attribute_public] => 0
    )

[1] => stdClass Object
    (
        [attribute_id] => 2
        [attribute_name] => groesse
        [attribute_label] => Größe
        [attribute_type] => select
        [attribute_orderby] => menu_order
        [attribute_public] => 0
    )

)
老实说我很困惑。 :/

我想要的只是一个属性树及其变体类型。

Grösse(尺寸)fE。应该有小/中/大的儿童/变异类型。

THX,

汤姆

1 个答案:

答案 0 :(得分:0)

get_terms是正确的,但在属性/ taxionomy名称中使用pa_前缀!

$term_children = get_terms('pa_groesse');