• Hi I’ve created coupons for 3 specific products that can be used only once. They seem to be working but from time to time I have some customers requests saying that when they want to pay there is an error message saying that the coupon has been used. If I check the coupon is marked as not used and I can apply it to my cart without issues.
    WP version 5.3
    Woocommerce 3.9

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi,
    I have the exact problem.
    The plugin was working fine before but now some of the clients told me the same story.
    The code seems fine when you apply it and before the payment. When you actually want to pay the error arrives and indicates that the code is already used. I have checked the code in the admin dashboard and it did not use.

    Please let me know!
    Bests,

    • This reply was modified 4 years, 9 months ago by erfanit.

    We’re experiencing the exact same issue as described here at our store at https://shop.standardlegal.com.

    Perhaps related to the most recent Woocommerce update?

    Sorry, I now see this support request is for the plugin ‘Coupon Generator’.

    I’m not using that plugin, even though I’m seeing the exact same issue.

    I’ll post this issue to a general Woo page, as it might be a system-wide coupon problem not specific to this plugin…

    hello,
    @allenfreeman @erfanit
    you can use the following code in ‘functions.php’ ,it will helpfull for you.

    add_filter(‘woocommerce_hold_stock_for_checkout’, ‘test_coupon_time’);

    function test_coupon_time() {
    return false;
    }

    indreshyadav thank you! That filter appears to work.

    Thread Starter francisco2611

    (@francisco2611)

    Hello, how do you know that the filter is working ? The issue seems to be random from my side. If I have a child theme installed, the code must be added in the functions file of the child theme ? thanks

    Yes, add to child functions file. I tested and coupons go through and still prevent multiple uses.

    My only concern is having the code in the child function if/when woocommerce fixes the issue…

    Hello
    @francisco2611 @francisco2611
    This issue is not from woocommerce core, in woocommerce 3.9.0, wooconnerce added the restriction to coupon for multipale transaction at same time.
    which plugin you are using to generate or import coupon. the issue in that plugin
    if you want to check go to coupon edit page and update that coupon and it’s working fine.

    Thread Starter francisco2611

    (@francisco2611)

    Hi, I’m using woocommerce coupon generator Version 1.1.0 | By Jeroen Sormani
    As you say I updated the coupon, re-enter it and seems to be working. The issue seems to be random and dont know where to look for some error log.
    Thanks

    I imported all of my coupons in using WP All Import.

    When I did this, I did not designate anything for the field “Individual use only” (which in the Coupon admin says “Check this box if the coupon cannot be used in conjunction with other coupons.”) So from my import, this box was not checked.

    I did import a “1” into Usage limit per coupon, Limit usage to X items, and Usage limit per user — as those are the three designations that keep usage to what I needed.

    After import, I was getting the Coupon already used error even though it hadn’t been. No with the code you provided for functions.php, all coupons I imported are working fine.

    @indreshyadav @allenfreeman @erfanitWhere

    Please where do I put the code to make it work?

    Twice stated: functions.php

    Do so in a child theme. Don’t mess with WP code directly…

    Hi, saw this is a topic already covered and I’m having the same problem.
    I’m not sure how to apply the coding that’s been suggested.
    Any help would be massively appreciated.
    Thanks ??

    The issue is that WooCommerce has added a usage_count field. All generated coupons will be affected. To solve – plugin should add that field as being a generated field :).

    Temporary fix – go to your DB, following query will add the usage_count meta field to the coupons if it doesn’t exist. Check if your prefix is different :).

    SELECT 
         wp_posts.ID, 'usage_count', '0'
    FROM 
         wp_posts
    WHERE wp_posts.post_type = 'shop_coupon' AND NOT EXISTS ( SELECT * FROM wp_postmeta WHERE wp_postmeta.meta_key = 'usage_count' AND wp_postmeta.post_id=wp_posts.ID )
    • This reply was modified 4 years, 8 months ago by dantwah.
    • This reply was modified 4 years, 8 months ago by dantwah.
Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Coupon already used’ is closed to new replies.