Support » Plugin: WooCommerce » Negative Fees Issue

  • Resolved Purnendu

    (@impurnendu)


    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 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Negative Fees Issue’ is closed to new replies.