Skip to content
Advertisement

WooCommerce: function that returns all product ID’s in a particular category

I think the title of the question is fairly self-explanatory, but to detail it…

I’m trying to make a custom category page in Woocommerce.

What I need is to return all the product ID’s in a particular category.

I’ve seen this post, but it uses the WP_Query way of doing things, which is pretty ugly.

I’d prefer to use something in the WooCommerce classes to accomplish this.

Ideally, there should some sort of function/method like the following (but I can’t find it):

JavaScript

Any help would be amazing.

Advertisement

Answer

Here you go:

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