Title: Plugin send two different coupon code
Last modified: May 28, 2018

---

# Plugin send two different coupon code

 *  Resolved [johnsongregor](https://wordpress.org/support/users/johnsongregor/)
 * (@johnsongregor)
 * [8 years ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/)
 * Hello, the plugin works great except that it sends two different coupon code 
   by mail for each items. I use “generate coupons automatically on processing order
   status”
 * Thanks for your support

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Plugin Author [Alberto Perez](https://wordpress.org/support/users/studiosweb/)
 * (@studiosweb)
 * [8 years ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10332349)
 * Hi [@johnsongregor](https://wordpress.org/support/users/johnsongregor/)
 * Ok we´ll review that.
 * Regards,
 *  [secobin](https://wordpress.org/support/users/secobin/)
 * (@secobin)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10357739)
 * The same thing happens to me
 *  [secobin](https://wordpress.org/support/users/secobin/)
 * (@secobin)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10380498)
 * is there a solution to the problem?
 *  Thread Starter [johnsongregor](https://wordpress.org/support/users/johnsongregor/)
 * (@johnsongregor)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10384224)
 * I really would like a solution because right now the plugin cannot be used in
   this state…
 *  [barns.be](https://wordpress.org/support/users/barnsbe/)
 * (@barnsbe)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10647823)
 * Same here.
    If I buy ONE gift voucher of €25, the recipient gets TWO mails with
   each a different coupon PDF of €25 (=value of €50). Is there a workaround? Thank
   You!
 *  [sylva1717](https://wordpress.org/support/users/sylva1717/)
 * (@sylva1717)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10708242)
 * The same thing happened to me, I changed 2 things and the problem is gone (plugin
   version 3.2.5, WP version 4.9.8):
    – the plugin created the database table with
   a wrong name – $table (this is the PHP variable in the code) – I changed it to{
   $wpdb->prefix}woocommerce_gift_coupon, where {$wpdb->prefix} is your prefix from
   the WP installlation – if I bought a coupon as a guest, a new line wasn’t inserted
   into this table (so I was able to generate infinite coupons for every guest order)–
   I removed the key from the id_user column to allow value 0 for guests and the
   plugin works as expected.
 *  [kelvinthegerbil](https://wordpress.org/support/users/kelvinthegerbil/)
 * (@kelvinthegerbil)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10899419)
 * Same issue here, but on a multisite installation.
    The fix was to removed the
   multisite id from the sql that creates the ‘woocommerce_gift_coupon’ table on
   install.
 * `$sql = 'CREATE TABLE IF NOT EXISTS $table( etc, etc, etc...';`
    Has the line
   below. `FOREIGN KEY (id_user) REFERENCES ' . $wpdb->prefix . 'users(ID)`
 * However $wpdb->prefix has multisite ID (i.e. ab_12_) which makes it look for 
   ab_12_users to create the foreign key restraint. But Multisite WordPress users
   a single table for users (in the examples’ case ab_users) so hard-code this, 
   or run the SQL separately to create the table and hey presto!
 * I hope this also helps someone.
 *  [jammin184](https://wordpress.org/support/users/jammin184/)
 * (@jammin184)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10907397)
 * I’ve tried this fix but for whatever reason, it’s not creating a fix. Even though
   I know it’s a free plugin it would seem that if it’s sending multiple emails 
   the plugin just isn’t working as described.
 *  Plugin Author [Alberto Perez](https://wordpress.org/support/users/studiosweb/)
 * (@studiosweb)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10942200)
 * I can´t reproduce the issue.
 *  [kelvinthegerbil](https://wordpress.org/support/users/kelvinthegerbil/)
 * (@kelvinthegerbil)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10942407)
 * Hi [@studiosweb](https://wordpress.org/support/users/studiosweb/)
    I think it
   is very setup specific and my “fix” didn’t fix the issue 🙁
 * The latest attempt which has worked so far, is to comment out the two action 
   calls that fire when woocommerce changes the order status to processing / complete.
   Add an extension that marks the order as complete automatically. And rely on 
   the action call “woocommerce thank you” (or similar).
 * I think that woocommerce is changing the order status multiple times in other
   areas which causes lots of codes and emails, and the bit in the plugin that marks
   a code as ‘sent’ just isn’t happening in our case.
 * It’s working, but I’ve lost sight of the original code and flow now because of
   pulling it around to find a fix.
 * The plugin does a great job in the most case, but I think it would be easier 
   to just process and send the vouchers and mark the order as a new order status(
   like sent) instead of automatically on processing, complete, manually and on 
   thanks.
 *  Plugin Author [Alberto Perez](https://wordpress.org/support/users/studiosweb/)
 * (@studiosweb)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10942458)
 * Hi [@kelvinthegerbil](https://wordpress.org/support/users/kelvinthegerbil/)
 * The initial idea was that. But you can´t change the status order automatically
   because this depends for the payment method.
 * We are reviwing the code for this issue.
 * Regards
 *  Plugin Author [Alberto Perez](https://wordpress.org/support/users/studiosweb/)
 * (@studiosweb)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10944364)
 * Finally i found a solution, probably i will add a new release at the end of this
   week.
 *  Plugin Author [Alberto Perez](https://wordpress.org/support/users/studiosweb/)
 * (@studiosweb)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10991221)
 * I close this issue, that is not a bug, its beccause the <FROM> of the email it
   ´s the same as the customer order email or because you have a old version of 
   the module.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Plugin send two different coupon code’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woocommerce-gift-coupon_997c86.svg)
 * [WooCommerce Gift Coupon](https://wordpress.org/plugins/woocommerce-gift-coupon/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-gift-coupon/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-gift-coupon/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-gift-coupon/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-gift-coupon/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-gift-coupon/reviews/)

 * 13 replies
 * 7 participants
 * Last reply from: [Alberto Perez](https://wordpress.org/support/users/studiosweb/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/plugin-send-two-different-coupon-code/#post-10991221)
 * Status: resolved