简体   繁体   English

更新 WooCommerce 可变产品变体库存数量问题

[英]Updating WooCommerce variable product variation stock quantity issue

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.我创建了 CRON 脚本,每 1 分钟检索一个实际的股票系统数据,将其转换为 WordPress/WooCommerce 数据库表并更新股票。

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 ).在数据库方面,一切看起来都正确且有效(请参阅第一个屏幕截图),但在 WP 管理面板中,只有父/主要变量产品库存数据显示为已更新 - 它总结了所有变化的 STOCK 数量(请参阅第二个屏幕截图)。 However he STOCK quantity data in Variations section for different sizes doesn't seem to be updated ( see 3rd screenshot ).然而,他在不同尺寸的变化部分的库存数量数据似乎没有更新(见第三个屏幕截图)。

Is there some kind of Caching that WooCommerce is using? WooCommerce 是否正在使用某种缓存? 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.因为到目前为止,我已经清除了所有缓存,但 Variation stock 仍然保持为 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)更新后的数据库- 库存 CRON 脚本更新变量库存(仔细检查,适用于所有变量和主要父变量产品库存库存 - 它汇总了所有变量库存) 数据库截图

Product variation after update - Stock CRON DID update this value, but it still shows 0.更新后的产品变化- Stock CRON DID 更新了这个值,但它仍然显示为 0。 变体产品截图

Variable/Parent product after update - Stock CRON did update the stock - SUMS up all variations STOCK quantitys and updates it here.更新后的变量/父产品- Stock CRON 确实更新了库存 - 汇总所有变化的 STOCK 数量并在此处更新。 变量/父产品截图

I've double checked everything.我已经仔细检查了一切。 CRON script is fine - as you can see from screenshots it does update data in database. CRON 脚本很好 - 正如您从屏幕截图中看到的那样,它确实更新了数据库中的数据。 The issue here is only that it doesn't show it in front for Variations of products.这里的问题只是它没有在产品变体的前面显示它。

:

After some hours of investigation I deactivated W3 Total Cache plugin.经过几个小时的调查,我停用了 W3 Total Cache 插件。 Still no changes.仍然没有变化。 And then I noticed WP Redis plugin.. soo I searched for Redis Object Caching on serverside and found it.然后我注意到 WP Redis 插件..所以我在服务器端搜索了 Redis Object Caching 并找到了它。 When I flushed the cache, the stock showed updated stock quantity.当我刷新缓存时,库存显示更新的库存数量。

Soo.. always double-check your caching. Soo.. 总是仔细检查你的缓存。 :D :D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM