A
A
altkov2021-12-26 16:28:28
WooCommerce
altkov, 2021-12-26 16:28:28

How to display attribute value name in woocommerce?

I'm trying to display the attributes on the category page, but instead of the name (40%, 43%), the $product->get_attributes() function and the attributes inside get id values ​​(17, 18, 19). How can I get exactly the titles or get the titles from these id's?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
altkov, 2021-12-26
@altkov

$attribute_values   = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( 'fields' => 'all' ) );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question