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/ )