How to create a Woo shop page, with a sidebar, displaying my categories

Finally I’ve solved it.

I set the Looper Provider to “Custom”, the hook to “parent_cat” and left the params empty.

In the themes function.php I put this:

  add_filter('cs_looper_custom_parent_cat', function($result, $args) {
   
    $parent_cat_id = isset($args['parent_cat']);

    $parent_cat = cs_dynamic_content($parent_cat_id);
    $args = array(
        'parent'        => $parent_cat,
        'taxonomy'      => 'product_cat',
        'hide_empty'    => 1,
    );
    $categories = get_categories($args);
    return $categories;
}, 10, 2);

And now the page displays only my top level categories, just as I wanted it.

Best regards
Bengt

1 Like

Hello Bengt,

It is good to know that you have resolved your issue already. We really appreciate for sharing the information and the solution you have made.

Cheers.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.