【问题标题】:Woocommerce - Get WC_Order_Item_Product line discountWoocommerce - 获取 WC_Order_Item_Product line 折扣
【发布时间】:2020-02-21 19:04:12
【问题描述】:

我一直在尝试这个,但没有成功,我正在尝试获得 WC_Order_Item_Product 应用折扣,或者更好的是,一旦在后端创建了订单,就可以享受折扣,例如:

(Backend)
Order #xxxx with 20% discount:
Item - Price - Amount - Total
Pen  -  10$   -   2    -  16$ (4$ discount)
Jar  -  30$   -   1    -  24$ (6$ discount)

是的,昂贵的罐子......所以我需要小计(16 美元、24 美元)或折扣,这样我就可以计算数学(4 美元、6 美元)并且还没有税(正如我所说,小计)。

试过:$wc_order_item_product->get_subtotal() 但它返回全价,没有折扣,我需要客户真正支付的价格(有折扣)。

在此先感谢各位,非常感谢。

【问题讨论】:

    标签: woocommerce product subtotal


    【解决方案1】:

    如果有人打破了头脑,我已经找到了解决方案,WC_Order_Item_Product 中的方法“get_total()”不会给出总数(价格总和+discount+taxes) 相反,它给出不含税的总额 (price+discount) =D

    【讨论】:

      猜你喜欢
      • 2018-02-26
      • 2014-02-12
      • 2016-10-07
      • 1970-01-01
      • 2018-03-08
      • 2018-01-24
      • 1970-01-01
      • 2023-03-31
      • 1970-01-01
      相关资源
      最近更新 更多