woocommerce购物车优惠券价格(不含税)显示

时间:2018-11-15 23:51:22

标签: woocommerce cart coupon tax

我希望woocommerce在购物车中显示不含税的价格,可通过使用优惠券降低价格。

我想拥有:

  • 不含税价格
  • 优惠券价值
  • 优惠券可将不含税价格降低
  • 含税价格

有人可以帮我吗?

我正在尝试使用此代码:

add_action( 'woocommerce_cart_calculate_fees','new_customers_discount', 10, 1 );
function new_customers_discount( $wc_cart ) {
    if ( is_admin() && ! defined('DOING_AJAX') ) // We exit

// Only for logged in users
if ($woocommerce->cart->applied_coupons)  // We exit

// Only for new customers without orders
if ( wc_get_customer_order_count( get_current_user_id() ) != 10000 ) return;  // We exit


// Calculation
$discount = $wc_cart->cart_contents_total - $coupon ;

$wc_cart->add_fee( __( 'Netto po rabacie', 'woocommerce')."", $discount);
echo '<div id="product-meta"><span class="detaliczna"><p class="item-description"  style="text-align:center; font-size: 14px; display: none; ">' . $wc_cart->add_fee( __( 'TEST', 'woocommerce')."", -$discount ) . ' zł netto</p></span></div>';

但是没有运气。我不是程序员。 :)

1 个答案:

答案 0 :(得分:0)

我知道了,但是我想更改顺序。我想将净价移至增值税之上

# a custom table container
sketch = htmltools::withTags(table(
  class = 'display',
  thead(
    tr(
      th(rowspan = 2, 'Species'),
      th(colspan = 2, 'Sepal'),
      th(colspan = 2, 'Petal')
    ),
    tr(
      lapply(rep(c('Length', 'Width'), 2), th)
    )
  )
))
print(sketch)

}

相关问题