How to set acf color field as background color to product category

Question

I have set an acf color picker field for woocommerce product category. I would like to set this color as a background to the category name that I’ve printed on the product page. I’ve tried to set the bg color value, but it doesn’t work.

The name of the color picker field is kollekcio_szine.

Here’s my code:

<?php echo $product->get_categories( ', ', '<span class="termek-oldal-kategoria-teszt"> style="background-color:<?php the_field('kollekcio_szine'); ?>"' . _n( 'Category:', 'Categories:', sizeof( get_the_terms( $post->ID, 'product_cat' ) ), 'woocommerce' ) . ' ', '.</span>' ); ?>

Could you help me how to do that, please?

0
Ben 4 months 0 Answers 13 views 0

Leave an answer