[Resuelto] Cannot use the _stock variable as a View filter
This support ticket is created hace 2 años, 2 meses. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
Sun
Mon
Tue
Wed
Thu
Fri
Sat
-
9:00 – 13:00
9:00 – 13:00
9:00 – 13:00
9:00 – 13:00
9:00 – 13:00
-
-
14:00 – 18:00
14:00 – 18:00
14:00 – 18:00
14:00 – 18:00
14:00 – 18:00
-
Supporter timezone: Asia/Karachi (GMT+05:00)
Este tema contiene 6 respuestas, tiene 3 mensajes.
I'm using Toolset and WC and need to filter products based on the stock quantity.
Looking at the database, _stock is the right variable to use for that.
So, I declared this variable in the Toolset settings as a custom field to use inside Views.
Now, I'm trying to create my filter inside the Views but I cannot see the _stock custom field. I have a Stock Quantity custom field but it seems it is not updated in real time.
How can I get access to the _stock custom field for my Views?
If you go to Toolset > Custom Fields do you see the automatically generated field group "Toolset WooCommerce", which can view but not change, that includes many WC fields, including the stock quantity (_stock).
They should all be accessible in the UI for filters etc.
You're right. As you can see in the screenshot, the _stock custom field is managed by Toolset with the name Stock quantity.
This is the one I'm using in my Views but the result I'm getting with this Views does not reflect the value in the database (or in the product inventory tab). Another point is that if I change something in the Views filter parameters (ie : move from number to text or vice versa), then, I'm getting the correct values, but only until the stock change again !!!
Don't know if this is an issue with some cache (I'm not using any specific cache other than those Toolset manage automatically).
This is really an issue as the Views are used to define which products are still available or not !
Sorry but the site is into production with a high load actually.
I don't understand why the _stock custom field content is not updated when I reload the page where the Views is.
Any idea?
Regards
Pat
In case the issue still persists and you're not comfortable sharing the production website's access details, you can share its clone/snapshot. This will allow us to investigate this, without affecting the production website.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )