• wpwench

    (@wpwench)


    Hi there, we’ve noticed a bug on our site where coupons are not applied automatically on IOS iPad & iPhone devices. The coupons are applied automatically for specific subscription products and everything works fine except on the IOS devices.

    After doing some testing we’ve discovered that it is directly related to the coupon cache despite checking in a new private/incognito window.

    When manually clearing the cache it will normally work for the first attempt but does not work again until cache is manually cleared even if that private browser sessions is closed and a new one is opened.

    We’ve confirmed this is the cause by adding a function that runs wac_r(“DELETE FROM wp_options WHERE option_name LIKE ‘_transient_wac_%’;”) on the wp_loaded hook and it does solve the issue but obviously this would be a temporary fix.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author rerm

    (@rermis)

    Hi there,

    Thank you for your report. The behavior you have described is by design to prevent an uninterruptible cycle. The coupon will auto-apply once. If the coupon is subsequently removed, it will not auto-apply again -to prevent an infinite cycle where a previously removed coupon is automatically applied on every page load. A coupon set to auto-apply and manually removed will apply again if another coupon is added and removed.

    The coupon cache will attempt to use a cookie, but if there is none available it will use the IP. That may be why the behavior appears to be different on iOS or in private tabs.

    Over 99% of auto-applied promotions will not be removed by the customer, so this issue will rarely surface outside of testing, but if you have any suggestions to improve this behavior please let me know.

    Thread Starter wpwench

    (@wpwench)

    Hello and thanks for the fast response.

    Tbh I don’t think this is by design because this happens without ever manually removing the coupon and the behaviour only seems to happen on IOS device.

    So just to clarify, we only close the browser, not manually remove the coupon.

    On desktop, I can test 10 times in a row in a private or standard browser and it doesn’t matter if I close the browser and open a new one, it will always apply the coupon automatically. So the behaviour is definitely different.

    Furthermore, when I was first alerted to this not auto applying and tested on a new IOS device with a new IP, the coupon didn’t auto apply.

    Some more odd behaviour on ios is ‘sometimes’ it would not be auto applying on the cart but it would auto apply after proceeding to the checkout from the cart.

    Plugin Author rerm

    (@rermis)

    Thank you for the additional insights and I appreciate your patience. Please allow us some time to try to replicate this in iOS and possibly find a fix for this scenario.

    Plugin Author rerm

    (@rermis)

    We have tested in more depth and determined that this scenario can occur when there are various caching plugins or server side caching enabled. If caching is turned off, the plugin performs as intended.

    Auto Coupons is always looking for a page load of the cart to auto-apply coupons. If caching plugins load the cart page from the cache instead of actually reloading the cart, auto-apply won’t be triggered.

    I recommend disabling caching on most WooCommerce pages, at the very least on the cart and checkout pages. Some caching plugins will offer to support different rules between mobile and desktop, these should be the same. Also, be wary of Redis Object Cache or WP Redis – this type of caching would be fine for a blog or search, but not a cart or checkout.

    Let me know what you find and if this resolves your issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.