Cannot get WC Archive page to work

Hello Friends,

I am trying to use the WC Archive layout to manage my Product Category pages and am struggling to find the correct looper settings to pull in SUB CATEGORIES for the MAIN CATEGORY and the PRODUCTS within the MAIN CATEGORY when on the CATEGORY PAGE.

3 Screenshots to Explain:


This is my layout… it is simple… want it to have the CATEGORY TITLE (is correct), CATEGORY DESC (is correct) then two sections… one with Sub Category listings (listings are incorrect)… one with the Product Listings (products within that category).


This is the output before the layout is applied. I want this data, the sub categories and products to show on my layout… but cannot seem to find the right looper settings to make this happen.

You can see that CATEGORY PAGE has 4 sub categories on it… but when the layout is applied I cannot get it to output those 4 sub categories onto the page.


This is the output to the page when it is applied… you can see that the sub categories are incorrect… the DBS ProShop isn’t tied to this Category in any way…

SETTINGS:
for the sub category section I have a ROW that is set to a looper provider with the CURRENT POST TERMS with the Taxonomy set to PRODUCT CATEGORIES with the title in the COLUMN set to {{dc:archive:title}} and it produces the output in the screenshot…

What I need:
To know what looper settings I need to get so the LAYOUT page produces the same output as the old page, as that is the right data for the page. The goal is to use dynamic content so I can apply this to all the PRODUCT CATEGORIES and clean up the look of the site a bit.

Note: I know the layout looks bad. I want to get the data going before I style it and move things around. There is no point in having a pretty page if I cannot get the correct data onto the pages.

Thank you!
Danny

Hello Danny,

Thank you for the very detailed post information. Perhaps this thread will help you:

Kindly let us know how it goes.

From reading through all of the thread you linked I looked in my category settings and standard is not an option… only Default, Products, Subcategories, Both… there is no “Standard” option… so not sure where to go or what to do…

The products seem to display fine / correctly, but the sub categories will not diplay… when I use {{dc:archive:name}} it simply used the name of the page itself, not of the subcategories… I need it to populate with the sub categories.

Hi Danny,

Can you please provide login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– Specific Layout you have created for this
– WordPress Admin username/password

To create a secure note, click the key icon underneath any of your posts.

Thanks

Edited for clarity - secure note with info created for you.

Hi Danny,

I have checked your website layout, and found that you are using the Products element which will not show the sub-categories you are expecting. You need to create a custom looper to get the sub-categories of the current category. I would suggest you go through the following thread on a similar topic.

Hope it helps.
Thanks

So I am working through your other thread and putting what I am doing here so that hopefully anyone else that needs this help doesn’t have to bounce back and forth to different support thread piecing the info together (I read tons of support articles prior to posting)

  1. I am adding a child theme.

The PRO Child theme is found here:
https://themeco-packages.s3.amazonaws.com/d940c8c440f230138995a40c4daf0904/child-themes/pro-child.zip

Child theme doc are found here:

  1. Adding this custom filter to my child theme function.php (as told to do here)

add_filter(‘cs_looper_custom_subcat’, function($result, $args)
{

$category = get_queried_object();

$cat_args = array(
‘hide_empty’ => 1,
‘child_of’=> $category->term_id,
‘taxonomy’ => ‘product_cat’,

);

$subcats = get_categories($cat_args);
return $subcats;
}, 10, 2);

  1. I set the ROW that I want the sub categories to appear to be a Looper Provider as CUSTOM then set the hook name to subcat.

END NOTE: this got closer to looking right, but although the page has 4 subcategories I ended up with 14 options in the list… I believe that is because my sub categories have sub categories and it is displaying them all.

So how do I get it to only show one level down?

Hi Danny,

You need to use the parent or depth attribute to get the immediate child of the category. I would suggest you go through the following article explaining both the attributes.

https://medium.com/@stefanledin/wordpress-how-to-get-only-direct-child-categories-286ad724f04b

Hope it helps.
Thanks

Alright, I’ve got the correct categories now after a bunch of reading and trying many combos of code… I will share later but for now I’d like to move onto the next item of getting the COLUMN BACKGROUND for the category to show and I cannot seem to get the correct DC code in the Background image portion of the column… in fact I cannot find any dynamic content thing to pull the Product Category Featured Image…

I’ve tried using:

{{dc:post:featured_image}} --> which outputs

{{dc:archive:featured_image}} --> outputs nothing.

How do I get the correct DC to make it so it shows the product category featured image?

Thank you!

Hi Danny,

To get the Product Category image, you need to use the following Dynamic Content code. I would suggest you go through the following thread on a similar topic.

{{dc:term:meta key="thumbnail_id"}}

Hope it helps.
Thanks

Using {{dc:term:meta key=“thumbnail_id”}} as the dynamic code for the product image worked. Thank you.

You are most welcome.

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