• Resolved electronicsalm

    (@electronicsalm)


    I have a an attribute that is a taxonomy, i need to update the attribute label. Here is what i’ve done iso far

    $args = array(
    ‘category’ => array(‘chinese’),
    ‘orderby’ => ‘name’,
    );
    $products = wc_get_products($args);
    foreach($products as $product)
    {
    $attribute = $product->get_attributes();

    foreach($attribute as $attributeItem)
    {

    if($attributeItem->is_taxonomy())
    {
    $attributeItem->get_taxonomy_object()->attribute_label = “new-label”; //set new label

    }
    }
    $product->set_attributes($attribute);
    $product-save();
    }

    If i read back the product attribute, the label is not updated (reading the old label), i need to update the attribute label and save it to the database so that when the value gets read back, it reflects the newly updated label.

    What am i missing ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Ross V. a11n

    (@rossviviano)

    Automattic Happiness Engineer

    Hi there,

    This is a fairly complex development topic, so I’m going to leave it open for a bit to see if anyone is able to jump in to help you out.

    I can also recommend the following places for more development-oriented questions:

    WooCommerce Slack Community: https://woocommerce.com/community-slack/
    Advanced WooCommerce group on Facebook: https://www.facebook.com/groups/advanced.woocommerce/

    Best,

    Ross

    Thread Starter electronicsalm

    (@electronicsalm)

    Thank you Ross, i can’t join the woocommerce slack workspace

    Look at below image below to see what happens when i try to join.

    image link >> https://ibb.co/hR0Q5vm

    is there some other specific way to join the channel ?

    Plugin Support mouli a11n

    (@mouli)

    Hi there!
    That page should generate an email with an invite to join the channel.
    I tested it for myself and it worked fine so I suspect that the issue you’re seeing may be browser related.
    Please try using another browser or even a different device.

    I hope that helps you to figure it out.
    Feel free to get back to us if you have further questions.

    Plugin Support Missy a11n

    (@m155y5)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please feel free to start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Woocommerce updating taxonomy attribute labels’ is closed to new replies.