function woocommerce_custom_fees( $cart ) { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; // non-taxable $cart->add_fee( 'Deposit', 6, FALSE ); // taxable $cart->add_fee( 'Delivery', 7, TRUE ); // test $10 discount //$cart->add_fee( 'Test discount', -10.00 , FALSE); } add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_fees', 25, 1 ); add_filter( 'woocommerce_calculated_total', 'discounted_calculated_total', 10, 2 ); function discounted_calculated_total( $total, $cart ){ $total = $total - 10; return $total; }
试过这种方式?