Skip to content
Advertisement

How to get attribute name instead of slug in variation?

I need to get attribute from woocommerce product variation.

JavaScript

This code is giving me an attribute slug instead of name. How can I get attribute name?

Thank you so much in advance!

Advertisement

Answer

What you are getting is the slug of a taxonomy… In WooCommerce, attribute_pa_color without the attribute_ is a taxonomy.

So you can try something like this.. to get the term by slug. And get it’s name.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement