1
A
回答
1
使用woocommerce_calculate_totals
動作鉤子鉤住這個自定義函數,你會從車總計(只是在購物車頁面顯示)中排除運費:
// For WooCommerce versions from 2.5.x up to 3+
add_action('woocommerce_calculate_totals', 'custom_cart_displayed_totals', 10, 1);
function custom_cart_displayed_totals($cart_object) {
if (is_admin() && ! defined('DOING_AJAX'))
return;
// Only on cart page
if (! WC()->cart->is_empty() && is_cart()):
## Get The shipping totals
$shipping_tax_amount = $cart_object->shipping_total;
$shipping_total_excl_tax = $cart_object->shipping_tax_total;
## Displayed subtotal
// $cart_object->subtotal = 0;
## Displayed TOTAL
// $cart_object->total = 0;
## Displayed TOTAL
$cart_object->tax_total -= $shipping_tax_amount;
## Displayed TOTAL
$cart_object->cart_contents_total -= $shipping_total_excl_tax;
endif;
}
代碼放在功能。你的活動兒童主題(或主題)的php文件或任何插件文件。
測試和工作...
相關問題
- 1. Woocommerce - 在購物車航運
- 2. WooCommerce - 刪除購物車?
- 3. WooCommerce woocommerce_check_cart_items和購物車總計
- 4. 向woocommerce購物車中添加費用
- 5. 如何排除woocommerce購物車總計小計?
- 6. 購物車頁面上
- 7. 更新購物車後,jQuery Ui Spinner在woocommerce購物車頁面中消失
- 8. 刪除添加到購物車按鈕,查看購物車,從woocommerce結帳頁
- 9. 添加購物車上的購物車
- 10. Woocommerce ajax從購物車中刪除
- 11. 購物車頁面上重複的運輸方式woocommerce
- 12. 購物車總計不會隨着購物車價格更新
- 13. 迷你購物車中的空購物車按鈕。 woocommerce
- 14. WooCommerce購物車頁面需要更新,無需更新購物車按鈕
- 15. 購物車設計面試
- 16. 產品從購物車中刪除後刷新頁面Woocommerce
- 17. 購物車頁面冒號
- 18. Woocommerce,購物車和會話
- 19. 如何在woocommerce中禁用購物車?
- 20. 輸入字段woocommerce購物車
- 21. 從總數購物車中刪除產品類別woocommerce
- 22. 首次點擊購物車頁面上的更新購物車按鈕後,優惠碼不會被刪除woocommerce
- 23. woocommerce運費不要顯示購物車頁面上之前地址插入
- 24. 導致使用彈簧在購物車中實現購物車
- 25. 購物車上的Woocommerce Plus/Minus按鈕
- 26. 在woocommerce中動態添加購物車
- 27. Cakephp購物車
- 28. C#購物車
- 29. Codeigniter購物車
- 30. asp.net購物車