I want to create a section showing an image and a text + a URL button of the PARENT categories for WC products.
I thought the query builder would help but it seems it would not allow me to do this in a dynamic way (please correct me if i’m wrong an show me the right configuration for it). so i thought of creating a query string.
the example code would be this:
$args = [
'taxonomy' => 'product_cat',
'hide_empty' => 0,
'parent' => 0 // Ensures only top-level categories are fetched
];
$query_string = http_build_query($args);
echo $query_string;
Which would return
taxonomy=product_cat&hide_empty=0&parent=0
However if i add that to the homepage, for example, i get 0 results when i should get more or less 3.
what could i be doing wrong?
I’m adding it to the looper provider of a slide container btw, and the actual slider is the consumer where we have the image and the text elements.