Site logo

Archived topic

product archive navigation & product count

11 replies · Started by sparkle on March 21, 2021

Viewing posts 1–12 of 12

i found this article:

https://generatepress.com/forums/topic/how-to-add-pagination-to-top-of-archive-posts-page/ and while i was able to get the navigation at the top of every archive with it, what i would really like is for it to be next to the woocommerce shop archive breadcrumb, but aligned to the right of that line. i tried messing around in generatepress elements to see if i could make this happen, but wasn't able to get the navigation to show up in the page.

https://imgur.com/a/vYmqupv

further, this little snippet doesn't replicate the pagination used at the bottom of the page, which i would prefer. i did try to do some custom styling, and got about 80% there... how to just duplicate the one at the bottom?

lastly, my product counts are showing out of stock products in their count. where do i adjust this? you can see this in the link in the category 'chakra balancing' it says we have 29 products but not all of those are in stock.

Hi there,

There are two sides you'll have to change things on.

First, you'll have to change the hook you're using. The code provided generate_before_main_content but if you want it to be "with" the breadcrumb, you'll have to use woocommerce_before_main_content.

You can actually just do this:

add_action( 'woocommerce_before_main_content', 'woocommerce_pagination', 30 );

So you don't have to bother writing the CSS to replicate the default pagination style as this literally copies the classes.

You then align them with css:

nav.woocommerce-breadcrumb + nav.woocommerce-pagination {
    margin-top: 0px;
}

nav.woocommerce-breadcrumb, nav.woocommerce-pagination {
    display: inline-block;
}

You may have to add margins and padding.

Stock counts of each item are set individually on Admin dashboard > All Products and find the product you have to change the stock count.

love your .sig! lol

thank you for the function. that did just what i wanted it to. i can manage the styling i think...

for the stock count, i think i didn't explain myself properly. i've got items that are out of stock that are being counted toward the quantity of items available in the category (count) on the shop page. so for example, for this category (runes) it says we have (2) in the category, but only one is in stock, so the other is hidden. how do i tell that (X) to only show in stock items?

https://imgur.com/xk0rQVW

Hi there,

not sure but have you tried:

Term counts > Recount Terms in Woocommerce > Status > Tools ?

oooh... that's an entirely new section to me, but sadly, that didn't change the count to exlude items not in stock.

Are the Out of Stock items still being displayed in the relevant archives ?

Odd - to the best of my knowledge the count is based upon the loop count itself.
Can you try clearing the:

WooCommerce transients
Expired transients
Clear template cache

In the Status > Tools.

same :-/

Unfortunately you might need to check with WooCommerce's support team on this if the suggestions above don't work.

Sounds good.

Hopefully they are able to help!

This archived topic is closed to new replies.