【问题标题】:Wordpress Woocommerce - Subtotal and totals don't matchWordpress Woocommerce - 小计和总计不匹配
【发布时间】:2021-08-18 01:44:42
【问题描述】:

我尝试使用此代码根据购物车总计获取不同的税种,但它没有在“总计”列中更新。

add_filter( 'woocommerce_product_get_tax_class', 'big_apple_get_tax_class', 1, 2 );

function big_apple_get_tax_class( $tax_class, $product ) {
    if ( WC()->cart->subtotal < 1000 )
        $tax_class = 'Tax-5%';
    elseif ( WC()->cart->subtotal >= 1000 )
        $tax_class = 'Tax-12%';
    return $tax_class;

【问题讨论】:

    标签: php wordpress woocommerce hook


    【解决方案1】:

    为什么会匹配?

    INR 100 的额外运费已添加到购物车中。如果您不打算在您的购物车中包含运费,请阅读 this documentation 以将您的运费设置为免费。

    然后会做。

    Item Price
    Subtotal INR 1575
    Shipping INR 0 (This is 0 now)
    TOTAL INR 1575

    而不是

    Item Price
    Subtotal INR 1575
    Shipping INR 100 (Removing this by free shipping)
    TOTAL INR 1675

    【讨论】:

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