Repository Forums Support WooCommerce Extended Coupon Features PRO Adding Items to Cart After Coupon is applied sometimes works Reply To: Adding Items to Cart After Coupon is applied sometimes works

#125
Soft79
Keymaster

Hi Kevin,

please try replacing the coupon_by_url function in includes/wjecf-autocoupon.php with the following:


public function coupon_by_url() {
    if ( ! $this->_executed_coupon_by_url && isset( $_GET['apply_coupon'] ) ) {
        $this->_executed_coupon_by_url = true;
        $split = explode( ",", $_GET['apply_coupon'] );
        if( ! WC()->session->has_session() )
        {
            WC()->session->set_customer_session_cookie( true );
        }            

        $cart = WC()->cart;
        foreach ( $split as $coupon_code ) {
            $cart->add_discount( $coupon_code );
        }
    }
}

Will that work for you? I will fix this in a future release.