• Resolved Rob

    (@qupodogbark)


    When I create a custom attribute through Products -> Attributes
    And then add custom terms to this attribute with descriptions

    And then create a variable product which uses those one of those attributes as a variation and use all terms as the variations…

    I loop through the variation in my template and var_dump the variation and see description=””
    I guess that’s because it’s pulling on the description available from the product’s edit screen. But how can I pull the more general term definition that I entered when editing attributes.

    (Sorry this is a bit confusing to explain, I can clarify if necessary…)

    https://www.ads-software.com/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Rob

    (@qupodogbark)

    I guess the variation is actually a different object (belonging to the product) than the term (belonging to the attribute) that it was generated from.

    What would be the best way to grab the term object that a variation was created from, so that I can get the term description?

    Thanks!

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Should be able to use this function: https://codex.www.ads-software.com/Function_Reference/term_description

    Just need to get the term ID from the attribute.

    Thread Starter Rob

    (@qupodogbark)

    Thank you, that helped.

    I should mention for future people the term ID wasn’t immediately available from the attribute within the variation object. I had to use get_term_by the slug, which was available in $variation['attributes']['attribute']

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using predefined attributes as variations doesn't return attribute description’ is closed to new replies.