• Resolved youssefhegazy

    (@youssefhegazy)


    It happens when POS plugin create a discount, because it create a coupon on fly and then remove it as soon as the order has been placed.
    To fix the issue, developers of Smart Coupons for WooCommerce should add a try/catch block at following path:
    public/class-wt-smart-coupon-public.php:361

    Wt_Smart_Coupon_Public::get_free_product_for_a_coupon

    code solution:

    public function get_free_product_for_a_coupon( $coupon_code ) {
        try {
            $coupon        = new WC_Coupon( $coupon_code );
            $coupon_id     = $coupon->get_id();
            $free_products = get_post_meta( $coupon_id, '_wt_free_product_ids', true );
    
            if ( '' != $free_products && ! is_array( $free_products ) ) {
                $free_products = explode( ',', $free_products );
            } else {
                $free_products = array();
            }
        } catch ( Exception $exception ) {
            $free_products = array();
        }
    
        return $free_products;
    }

    Can you integrate the solution suggested above because I can’t apply any discount through POS while this error occured

Viewing 1 replies (of 1 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @youssefhegazy,

    Thanks for reaching out and we are sorry for the delayed response.

    We have added the mentioned enhancement in our development pipeline and will consider it in our upcoming release. Thanks for understanding.

Viewing 1 replies (of 1 total)
  • The topic ‘Missed management of not existing coupon in YITH POS’ is closed to new replies.