Support » Plugin: WooCommerce Gift Coupon » Plugin send two different coupon code

  • Resolved johnsongregor

    (@johnsongregor)


    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

    (@studiosweb)

    Hi @johnsongregor

    Ok we´ll review that.

    Regards,

    The same thing happens to me

    is there a solution to the problem?

    I really would like a solution because right now the plugin cannot be used in this state…

    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!

    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.

    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.

    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

    (@studiosweb)

    I can´t reproduce the issue.

    Hi @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

    (@studiosweb)

    Hi @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

    (@studiosweb)

    Finally i found a solution, probably i will add a new release at the end of this week.

    Plugin Author Alberto Perez

    (@studiosweb)

    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.