• Resolved vaibhav12321

    (@vaibhav12321)


    In my website I create a coupon with amount 100 and checked the checkbox “applied as cashback”
    But at the time of checkout when I apply coupon the cart value is reduced to 100.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    @vaibhav12321,

    Coupon will not be applied as cashback if user not logged in or you are trying to buy wallet rechargeable product with that coupon. Please check those criteria and let us know.

    Thanks and regards,
    Subrata Mal

    Thread Starter vaibhav12321

    (@vaibhav12321)

    Okay the user was not logged in.
    Any script you have to prevent this?

    Plugin Author Subrata Mal

    (@subratamal)

    @vaibhav12321,

    Sorry we don’t have script for that.

    Thanks and regards,
    Subrata Mal

    Thread Starter vaibhav12321

    (@vaibhav12321)

    Okay thank you. 5 star for you for great plugin.

    I solve with following code:

    //define the woocommerce_applied_coupon callback 
    function action_woocommerce_applied_coupon( $array, $int, $int ) {
        global $woocommerce;
        $coupon_id = 'btc';
        if($coupon_id==strtolower($array) && is_user_logged_in()==false){
            WC()->cart->remove_coupon( $coupon_id );
            ?>
            <ul class="woocommerce-error" role="alert">
                <li>You need to login first to apply this coupon!</li>
            </ul>
            <?php
            wc_clear_notices();
            die();
        }
    }
    //add the action 
    add_action( 'woocommerce_applied_coupon', 'action_woocommerce_applied_coupon', 10, 3 );
    
    Plugin Author Subrata Mal

    (@subratamal)

    @vaibhav12321,

    Happy to hear from you that you have solved the above problem. And thank you very much for sharing your feedback review for our plugin.

    Cheers!!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Coupon as a cashback not working’ is closed to new replies.