【发布时间】:2020-11-20 08:09:46
【问题描述】:
使用以下代码,当购物车小计达到特定金额(此处为 150波兰兹罗提):
function override_inpost_cost( $rates, $package ) {
// Make sure paczkomaty is available
if ( isset( $rates['easypack_parcel_machines'] ) ) {
// Current value of the shopping cart
$cart_subtotal = WC()->cart->subtotal;
// Check if the subtotal is greater than 150pln
if ( $cart_subtotal >= 150 ) {
// Set the cost to 0pln
$rates['easypack_parcel_machines']->cost = 0;
}
}
return $rates;
}
add_filter( 'woocommerce_package_rates', 'override_inpost_cost', 10, 2 );
但问题是运费税原始成本仍然存在,即使“easypack_parcel_machines”运输方式费率成本设置为零其原始成本(因为它是应税的)。
如何更改代码,如果“easypack_parcel_machines”运输方式费率设置为 0,税收也将设置为零?
【问题讨论】:
标签: php wordpress woocommerce tax shipping-method