fbpx
Enjoy Year-End Sale: 50% Off All Plugins! Coupon Code: NewYear2025

Creating attributes through the Woocommerce API

Hi, I’m looking for a plugin to be able to define different types of attributes through the WooCommerce API. I would like to know if this plugin is possible and if you have any documentation on this. I hope you can help me with this.
Thanks in advance

Hakik Zaman

Hi Angel,

Thanks for reaching out to us.

You can use WooCommerce API to create different types of attributes using our Variation Swatches Plugin.

You can install our Free version. Then try-

GET Request: wp-json/wc/v3/products/attributes/<attribute_id>/terms/<id>

You will get a response like:

"woo_variation_swatches": {
"attribute_type": "color",
"primary_color": "#1e73be",
"secondary_color": "",
"is_dual_color": false,
"dual_color_angle": "-45deg",
"image_id": 0,
"image_size": "variation_swatches_image_size",
"group": "",
"group_name": "",
"tooltip": "",
"tooltip_text": "",
"tooltip_image_id": 0
}

Then you can also use PUT to update terms.

PUT Request: wp-json/wc/v3/products/attributes/<attribute_id>/terms/<id>

You can get an example from woo-variation-swatches > includes > class-woo-variation-swatches-wc-api-response.php > line number 89

I hope this information will help.

Thank You