Tagged: out-of-stock, Product Grid, woocommerce
-
AuthorPosts
-
March 22, 2023 at 10:14 am #1401985
Hello,
we have the problem that the product-grids keep showing out-of-stock-products even when using the hide-products out of stock funktion within the product grid. woocommerce itself is also set th hide products out of stock and they aren´t shown on the shop-page or native product-category-sites.
Please help, Best Regards MarcMarch 24, 2023 at 11:49 pm #1402412Hey marcfrey,
Thanks for your patience and the link to your site, I tested the same product grid settings as yours on my shop demo site and the out-of-stock-products didn’t show, I see that your are using Enfold v5.2.1, please update to the most current version 5.5 and check again. If this doesn’t help try disabling your plugins. If that resolves the issue, reactivate each one individually until you find the cause.Best regards,
MikeMarch 28, 2023 at 12:58 pm #1402781Hallo Mike,
thanks for helping.
I think I found it… unfortunatly the problem can´t be solved on my end:
Because we have a large amount of products in our shop, we set instoch/outofstock by wp-allimport according to the information of our supplier.
This is no probem to the native woocommerce grids (hinding outofstock works there) but it seems that the enfold grids need the manual switch-action between instock and outofstock.
If I pick a product, which ist shown in the enfold grid and which is outofstock, set it to istock manualy (an save), then set it to outofstock again, it disappears in the grid.
I guess I´m not the only show-owner with many products, maybe you could change the “detection” for instock/outoufstock so that it works the same way as the native woocommerce function. Would help me a lot ;-) I´m aware that this won´t be a top-priority task.
Best regards,
MarcMarch 28, 2023 at 6:52 pm #1402809Hi,
Glad to hear that you found the cause, to help me understand the issue so I can submit it to the Dev Team, you are downloading a xml file from your supplier of your products which you upload via the All Import plugin, this file sets the stock status of the products, correct?
Can this import file be imported directly via the WordPress Importer or must the All Import plugin be used?
Your plugin looks like a paid only plugin, so this could be an issue for the Dev Team to test how the plugin is setting the stock status, our elements are using the woocommerce function to look for the stock status, when we export products using the WordPress export feature and then import the xml file into a different install with the WordPress import feature the stock status is correct for both Enfold elements and woocommerce elements.
Have you tried going to WooCommerce ▸ Status ▸ Tools and updating WooCommerce transients, or Update database, or regenerate the Product lookup tables?Best regards,
MikeMarch 30, 2023 at 2:45 pm #1403018Hey Mike
Thanks for looking into this.
Yes, https://www.wpallimport.com/export-wordpress/ is a somewhat well-known paid plugin for people running shows with many products. We are using this instead of standard wordpress export because we have to match,import and updats custom fileds like gtin, supplier and so on. Another reason is the all-export/import uses csv files for both export and import instead of export as xml and import as csv. This makes the whole workflow much easier.
It´s realy strange that there is a difference between import via all-import and standard wordpress import especially when woocommerce-grids can work with both an enflod can not. No offence. Didin´t expect this.
If´ve tried all the mentioned tools but there are still outofstock-products visible in the enfold grids.
If this is any help – feel free to test with the current staging as you wish. I will create a new one in a few weeks.
Beste regards MarcApril 1, 2023 at 4:04 pm #1403213Hi,
Thanks for the feedback I have submitted this to the Dev Team for their review. Please leave the staging site access active for them to test and reply here, otherwise, I will reply when I hear back. Thank you for your patience.Best regards,
MikeApril 3, 2023 at 11:51 am #1403373Hi,
I digged into the core code of WC.
With WC 3.0 the info for stock/out of stock was moved from meta data query to tax query and the meta data query was deprecated and is no longer supported by WC core.
It seems, that your import plugin does not take care of that. As mentioned above, after saving a product stock/out of stock is recognized correctly.
I think to be backwards compatible with older code WC still fills the meta data field – but this is nothing to rely on.
The only thing I can offer is to add a filter that allows you activate the meta data query instead of the tax query. This is not an option to select but you will need to add some php code we can provide you.
The preferred way would be to contact the import plugin authors that they should fix this. Or you add a script that sets the taxonomies correctly after import.
Best regards,
Günter- This reply was modified 1 year, 7 months ago by Günter.
April 3, 2023 at 12:05 pm #1403379Hello Günther,
thank you! In short terms: I used an outdated query for the stock-info when I was importing. The only reason it works with woocommerce-grids is that WC still recognizes this to be backwards compatible.
So everything I have to do is to find the right field for matching the stock status and reimport/update the status.I was not expecting an import-error because it seems to work fine – I´m sorry that you had to invest so much time in my problem.
Many thanks for your excellent research and help!!! (and your offer to add a filter – I think the only real solution is to change the import-matching or this will end working some day)Best regards Marc
April 3, 2023 at 1:06 pm #1403387Hi,
I’m afraid this is not so easy.
Lets say your product has the ID 6499.
Then in the post meta for this post_id you find meta_key:
_stock_status
This is I think the “old” field (has meta_value e.g. outofstock, instock).
For the new tax query have a look into enfold\config-woocommerce\config.php around line 2981 function avia_wc_set_out_of_stock_query_params(…)
Database tables involved are wp_terms, wp_term_taxonomy, wp_term_relationships.
To be honest, I did not dig deeper how it is set by WC. But I think you need to set the “outofstock” term to wp_term_relationships
object_id = post_id, term_taxonomy_id = term_id of “outofstock” found in wp_termsHope this helps you a little.
the only real solution is to change the import
Yes, this would be the future safest way
Best regards,
Günter -
AuthorPosts
- You must be logged in to reply to this topic.