Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 65051

Negative Fees Issue

$
0
0

Replies: 0

Hi mates,
I am trying to add a discount on payment gateway basis. When I put positive value, it is working, but when I put negative value, it automatically adds taxes. Please, someone, help me to get rid of this. e.g. My cart value is 4087, after discount it should 4037! But………

function purnendu_apply_payment_gateway_fee() {
$payment_method = WC()->session->get( ‘chosen_payment_method’ );
$mincartgateway = WC()->cart->total;
if( $payment_method == ‘paytm’ && $mincartgateway>=200) {
$label = __( ‘PayTm Discount’, ‘fario’ );
$amount = -50;
WC()->cart->add_fee( $label, $amount, false, ” );
}
}
add_action( ‘woocommerce_cart_calculate_fees’, ‘purnendu_apply_payment_gateway_fee’ );


Viewing all articles
Browse latest Browse all 65051

Trending Articles