【问题标题】:How to exclude subtotal from woocommerce cart total?如何从 woocommerce 购物车总数中排除小计?
【发布时间】:2016-09-26 10:30:55
【问题描述】:

我在我的 woocommerce 网站上提供在线租赁服务,我只想收取可退款金额,但还想显示产品金额,但当客户去查看购物车时。小计中显示了产品总数我想要最终的总金额,其中不包括产品总金额,仅包括可退款金额

一般购物车:- $total=$subtotal+$refundable 我需要:- $total=$refundable

我该怎么做

【问题讨论】:

  • 请查看 www.instarents.com 网站并前往购物车。会有产品和可退款金额,但最终总金额仅包括可退款金额
  • 但请再次您能否尝试进一步澄清您的问题,对其进行编辑(可能另外给出一个具体示例)并在其中包含您的网站链接。谢谢

标签: woocommerce cart


【解决方案1】:

尝试将您的退款添加为自定义费用。请参考这个example

    function woo_add_cart_fee() {
      global $woocommerce;  
      $woocommerce->cart->add_fee( __('Refundable deposit', 'woocommerce'), -3750.00 ); 
// since its going to be refund we should add fee in negative value.  
// You can add the refund as fee in this hook
    }
    add_action( 'woocommerce_cart_calculate_fees', 'woo_add_cart_fee' );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-21
    相关资源
    最近更新 更多