Skip to content
Advertisement

WooCommerce product custom additional taxonomy in a loop issue

I am trying to display custom taxonomy field’s names and descriptions for single products in a loop.

I’ve created custom product taxonomy

JavaScript

next created sample tags: One, Two and assigned them to the Product (via ACF plugin)

I want them to be displayed on product page. I was trying to use this code:

JavaScript

but there is an issue I cannot address:

Warning: foreach() argument must be of type array|object, bool given in

What am I doing wrong?

Advertisement

Answer

Update (related to your comment)

You need to check that $terms variable is not empty before in your last function and also that each term exists like:

JavaScript

This should solve the issue.

You If your otheer issue persist, you can also try to replace from my code:

JavaScript

with:

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