• adnovasi

    (@adnovasi)


    Good plugin but I think i found two defects:

    1. To apply the coupon the link should be https://www.example.com/coupon?code=couponcode and NOT https://www.example.com/coupon/couponcode

    2. When clicking the URL to add the coupon, if the cart is empty or there is no session yet, the coupon won’t persist. Also no error will be returned in this case. To solve this, just needs to persist a session cookie before calling the WC->cart->add_discount function.

    // Set a session cookie to persist the coupon in case the cart is empty.
    WC()->session->set_customer_session_cookie( true );

    Thanks!
    adnovasi

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Works great but has two defects that can be fixed easily’ is closed to new replies.