3

Soo.. I've created CRON script, that each 1 minute retrieves an actual stock systems data, converts it for Wordpress/Woocommerce database table and updates stock.

On database side everything looks right and works (see 1st screenshot), but in WP Admin Panel only parent/main variable product inventory data shows as updated - it SUMS all variation STOCK quantities (see 2nd screenshot). However he STOCK quantity data in Variations section for different sizes doesn't seem to be updated (see 3rd screenshot).

Soo I was wondering.. is there some kind of Caching that WooCommerce is using? And if so.. how can I clear it? Because so far I've cleared all the cache there is, but Variation stock still stays 0.

Screenshots & Descriptions

Database after update - Stock CRON script updates Variation stock (double checked, works for all Variations and main parent Variable product Inventory STOCK - it sums all Variations STOCKS) Database Screenshot

Product variation after update - Stock CRON DID update this value, but it still shows 0. Variation Product Screenshot

Variable/Parent product after update - Stock CRON did update the stock - SUMS up all variations STOCK quantitys and updates it here. Variable/Parent Product Screenshot

I've double checked everything. CRON script is fine - as you can see from screenshots it does update data in database. The issue here is only that it doesn't show it in front for Variations of products.

A help would be much apreciated! :) Thanks in advance.

4
  • Try updating the variation stock in the backend, and see what it stores in the DB. I think there is a meta value like _variable_stock
    – Pim
    Oct 15, 2018 at 7:51
  • @Pim Unfortunately there is no such meta_key in postmeta table.
    – richardev
    Oct 15, 2018 at 10:57
  • could you share your code with us ?
    – nikosvl97
    Dec 14, 2020 at 14:05
  • @nikosvl97 its been 2 years already. I don't have the source code. Also the issue was with Redis Object Caching. If you're referring to stock update cron - try googling. Here's first result i got regarding this situation.
    – richardev
    Dec 14, 2020 at 17:07

1 Answer 1

2

After some hours of investigation I deactivated W3 Total Cache plugin. Still no changes. And then I noticed WP Redis plugin.. soo I searched for Redis Object Caching on serverside and found it. When I flushed the cache, the stock showed updated stock quantity.

Soo.. always double-check your caching. :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.