WooCommerce Custom Layout Including Out of Stock Products in Count

Hi folks,

We’re building an eComm site for an electronics recycler. They’ll have a lot of 1-off products with inventory of 1 — thus, we’ll have a lot of Out of Stock products.

We’re running into an issue where the number of products per page are incorrect. My guess is that the Loop is running against the products, getting 12 of them and then removing the Out of Stock products — instead of discarding Out of Stock and then getting the next twelve. You can see that this wrecks havoc on some pages:

https://getrepowered.org/all-products/page/2/

We need filters on the shop page (so don’t want to mess with wp_query too much), but we also don’t want empty pages.

Have you seen this issue before? Any advice on how to approach the fix?

(Products are super dirty right now, as we just imported 2k from Shopify for retaining customer information.)

Hello @lukefinsaas,

Thanks for writing to us.

In order to help you with your concern, we need to check your settings. I would request you, please share your details in a secure note. Please provide the following details meanwhile you must troubleshoot a few common issues before we investigate your settings.

  • WordPress Login URL
  • Admin level username and password
  • Exact layout URL

You can find the Secure Note button at the bottom of your posts

Thanks

Attached to this note! Thanks.

Hello @lukefinsaas,

I have investigated your issue and tried to replicate the issue on my local testing server. There is no issue on my test server. All of the the out of stock products will not display and the shop index displays the correct number of “In Stock” products. I went ahead and logged in to your site. I exported all your products and then imported it to my test server. I was able to replicate the issue. It only displays limited number of in stock products and not the actual products in each page.

Have you imported these products from another platform? If you do, there must be something that changes the product meta or that the previous platform has some issues with Commerce when imported.

Can you please clone your site to staging site so that we can continue troubleshooting in the staging site without having to put your live site in construction mode. If you are not familiar with the staging sites, please check this out:

Best Regards.

Got it!

Yes, these products were imported (poorly) from Shopify. Luckily, we’ll delete them once our orders have been migrated — just wanted the orders to be linked to real products, as I’ve read that can cause issues in reporting later.

I’ll check back in once we remove the products.

If possible to leave this topic open, that’d be great. I’m hoping to have it done this week, but the Order import’s run all weekend and we’re around 20% done so…

Hi @lukefinsaas,

The thread automatically closed after 10 days of the last reply, so it will be open till next week.

Thanks

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