• Hi Jeroen,

    Since I upgraded to WooCommerce 3.9 all of our auto-generated coupon codes no longer work. They get applied in the cart at checkout just fine, but when the final payment is trying to go through, it stops and says: “Coupon 0rru-lgpx-8cmd was used in another transaction during this checkout, and coupon usage limit is reached. Please remove the coupon and try again.”

    So, I edited that coupon and simply clicked save and it worked with no problem.

    I then did some looking at the posts_meta table to see what had changed.

    Here is a screenshot of before: https://cloud.madebysprung.com/L1ukloD6

    Here is a screenshot after it is saved: https://cloud.madebysprung.com/RBuX25rg

    Can you tell me how we can fix this? I don’t want to go through thousands of autogenerated coupons and resave them. ??

    Thanks!

Viewing 3 replies - 16 through 18 (of 18 total)
  • @mohitmishra Thank you for the explanation! I get it now and have reached out to the folks that author my coupon import plugin. They quickly updated the plugin to support the new functionality.

    My plan is to leave the filter function in place for now, until the coupons that were imported before the plugin update have expired. Once all the “bad” coupons have expired, I’ll remove the code.

    Thanks for the filter code and the explanation. I appreciate your help!

    This plugin is just missing usage_count meta set to 0 when creating a coupon, once that is set, it will work without the filter. Had the same issue with my refer a friend plugin.

    • This reply was modified 4 years, 8 months ago by Goran87.

    I can confirm the issue with the usage_count meta field.

    You can use this filter to insert it on coupon creation.

    
    add_filter( 'woocommerce_coupon_generator_coupon_meta_data', function($meta, $coupon_id){
    	$meta['usage_count'] = 0;
    	return $meta;
    }, 10, 2);
    
Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Auto Generated Coupon Code not working’ is closed to new replies.