Skip to content
Advertisement

Display specific custom product attributes on single product pages in Woocommerce

I found the following code to display all custom attributes on a product detail page (with a specific bar-style design that I need). The code works like a charm and I have the proper CSS to display horizontal bars of my custom attributes.

Problem I have is that I only want to display specific named attributes and don’t know how to change the loop to do that…

JavaScript

Advertisement

Answer

In the following code you will define first the desired product attributes slugs in an array, that will get displayed in single product pages:

JavaScript

Code goes in function.php file of your active child theme (or active theme). Tested and works.

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