+1, same issue here: With the plugin enabled many products aren’t listed anymore. Until this issue has been fixed I have to keep this plugin disabled.
The same happened with my client’s site right in the middle of a busy holiday sale. Took me some time to find out which plugin was causing the issue. Too bad I had to deactivate it.
Hi @mo123z @strarsis @amgill
Sorry to know that the plugin is not showing some of your products. This is a known issue and I have added troubleshooting steps on plugin page aswell.
You can read it under “Troubleshooting” section.
https://wordpress.org/plugins/rearrange-woocommerce-products/
I am pasting the same steps here, let me know if that helps.
The workaround solution for this is to simply go to Admin > Rearrange Products > Sort by Categories and then select each category one by one from the Dropdown, and DON’T click the “Save” button. This will update all categories metadata into database one by one and will fix your issue. This is just a one-time process and it will fix your issue forever.
What is happening here is that the categories that you have not organized, don’t have metadata(for sort order) in the database. And because of that, some products don’t appear on those categories.
Kind regards,
Aslam
@aslamdoctor: Thanks! It may be a good idea to add this fix in a plugin activation/update hook, so this is automatically performed upon plugin activation/update?
@strarsis thanks for the suggestion. I already thought about that but what it does when you select specific category in the plugin admin is that it creates required meta data for all its products in database. Which means if I add that action on activation/update hook, I have to do this for all categories (which means all products) and creating meta data of every product on plugin activation is not a good idea. What if someone has huge database like 1000+ products? then there will be 1000+ sql queries on plugin activation.
So as a solution, I am thinking that I will add tab under plugin page where there will be a button called “Update Database” and here I will safely run bulk queries using ajax request so nothing can break.
If you have any other better suggestion, please do let me know. I am interested to find out other options 🙂
Thank You,
Aslam
@aslamdoctor: You could modify the query that sorts the products by making it compatible with product posts that don’t contain the custom category-specific menu order in their post meta, then you don’t have to initialize all product posts with this custom post meta. (https://wordpress.stackexchange.com/questions/24085/meta-query-for-keys-that-arent-yet-set)
@strarsis that’s great. I will give it a try and make it available in next update if all goes well.
Thank you