duanmanmian7589 2016-04-04 08:56
浏览 60
已采纳

WC_Order-> get_items()没有填充`tax_class`字段

In Woocommerce, var_dumping an order shows an empty field tax_class, but tax classes are defined and assigned correctly to the product.

enter image description here

enter image description here

Here is my code:

array(13) {
  ["name"]=>
  string(14) "Nuovo prodotto"
  ["type"]=>
  string(9) "line_item"
  ["item_meta"]=> ...
  ["item_meta_array"]=> ...
  ["qty"]=>
  string(1) "1"
  ["tax_class"]=>
  string(0) "" <-- this shouldn't be empty
  ["product_id"]=>
  string(2) "54"
  ["variation_id"]=>
  string(1) "0"
  ["line_subtotal"]=>
  string(6) "5.8824"
  ["line_total"]=>
  string(6) "5.8824"
  ["line_subtotal_tax"]=>
  string(6) "1.2941"
  ["line_tax"]=>
  string(6) "1.2941"
  ["line_tax_data"]=> ...
}

What I am doing wrong?

  • 写回答

1条回答 默认 最新

  • doutangguan2460 2016-04-04 09:47
    关注

    The answer is that is completely normal

    Because for a product, when tax class value is set on default the corresponding data stored in the database is 'meta_key' = '_tax_class' => 'meta_value' = ''. So the value is empty.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来