Title: programmatically updating product&#8217;s attributes
Last modified: September 24, 2019

---

# programmatically updating product’s attributes

 *  Resolved [NSPT](https://wordpress.org/support/users/nsptfr/)
 * (@nsptfr)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/programmatically-updating-products-attributes/)
 * Hello,
 * I’m using add_action( ‘woocommerce_product_data_panels’, ” ); to modify some 
   product metas while updating it.
    I wrote some code using the set_attributes()
   methode from WC_Product classes, but after saving the product using the save()
   methode, nothing appears in the Attributes pannel,
 * Can you help me please ?
 * Regards

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [con](https://wordpress.org/support/users/conschneider/)
 * (@conschneider)
 * Engineer
 * [6 years, 8 months ago](https://wordpress.org/support/topic/programmatically-updating-products-attributes/#post-11962720)
 * Hi there,
 * Here is an approach that uses `wp_ajax_woocommerce_save_attributes`
    [https://stackoverflow.com/questions/52283313/how-can-i-save-a-custom-field-of-an-attribute-in-woocommerce](https://stackoverflow.com/questions/52283313/how-can-i-save-a-custom-field-of-an-attribute-in-woocommerce)–
   maybe you can use this as a starting point.
 * Kind regards,
 *  Thread Starter [NSPT](https://wordpress.org/support/users/nsptfr/)
 * (@nsptfr)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/programmatically-updating-products-attributes/#post-11963516)
 * Hello,
 * I’ll just give up… I’m tiered of working on that.
 * mikejolley tells on github that ‘Using wp_ajax hooks is not ideal.’ [https://github.com/woocommerce/woocommerce/issues/16934](https://github.com/woocommerce/woocommerce/issues/16934)
   
   The exemple use neither the “_product_attributes” variable, or the “WC_product-
   >set_attributes()” methode. And I don’t understand why. Even if I update “_product_attributes”
   variable, it is not a unique field and will only result on an other stack impossible
   to get.
 * What I don’t understand is what blocking me from setting the attributes with 
   the dedicated methode of the class… I can do anything else like setting tags 
   and categories, but set_attributes always result in nothing.
 * Thanks,

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘programmatically updating product’s attributes’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [NSPT](https://wordpress.org/support/users/nsptfr/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/programmatically-updating-products-attributes/#post-11963516)
 * Status: resolved