• Resolved catheg

    (@catheg)


    Hi there,

    The taxonomy_is_product_attribute function returns false if you specify your own ID of an attribute, is-it the normal behavior ?

    Thx for your help.

    Catherine.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Adam Heckler

    (@adamkheckler)

    Catherine,

    The taxonomy_is_product_attribute function returns false if you specify your own ID of an attribute, is-it the normal behavior ?

    It looks like that function expects a string to be passed, not an ID number:

    https://github.com/woocommerce/woocommerce/blob/4.7.0/includes/wc-conditional-functions.php#L301

    I would adjust your code to pass the name of the attribute.

    If you need further help with custom code (it’s not something we can really help write or troubleshoot), you might want to check our Customizations page.

    Thanks!

    Thread Starter catheg

    (@catheg)

    I wasn’t very clear, by own ID, I mean to say slug.

    For example if I create an attribute with :
    name : color
    slug: generated par woocommerce color

    taxonomy_is_product_attribute(“color”) returns true

    If I create an attribute with
    name : color
    slug : I change with my own value 0101-color

    taxonomy_is_product_attribute(“color”) returns false

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘taxonomy_is_product_attribute’ is closed to new replies.