dsfvsdfv23599 2017-02-14 16:08
浏览 50

WooCommerce返回类别不一致的产品数量

On a WordPress site with WooCommerce I use this function to query for the number of products in a category

 $check_products = get_terms( array( 'taxonomy' => 'product_cat', 'include' => $element->object_id ) );

This is inside a menu_walker class to add the number of products to the category name in a menu-option, like this New Products (10). This site sells unique products, so after selling an item, the item is out of stock.

This works fine, but after installing WPML there is a difference in count. The site has a default language and a WPML translated version. When you buy something while using default language, the menu-option will show the correct adjusted number of products. Switch to the WPML translated version, and the number is unchanged (too high).

The same error happens when you buy something from the WPML translated version and then switch to the default language version.

How can the same function return a different value?

If already tried to clear/reset information in the Tools menu of WooCommerce but no luck yet.

  • 写回答

1条回答 默认 最新

  • drvonr6573 2017-02-17 16:18
    关注

    After going back and forth with WPML support a few times, they were willing to escalate the issue to the 2nd line of support.

    Will update this answer when there is news on the matter.

    The issue in short: When WooCommerce updates the product_count_product_cat entry of a category after a purchase, WPML doesn't notify WooCommerce to do the same for the other (translated) instances of the category.

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100