What to do if 2 gift cards are being created on orders paid via PayPal

If you notice two different gift cards being sent to the same recipient incorrectly, this most likely is caused by an incorrect PayPal configuration setting.

This happens for orders that are paid by PayPal.

Check the Order Notes section and see if there are two references to the order being marked Complete. You should also see something referencing IPN and PDT as separate line items.

What is happening is the payment confirmation from PayPal is being sent to your site using two separate methods, at nearly the exact same time. This means the order gets processed two times.

The problem is known by WooCommerce and it causes other problems like incorrect stock quantity deductions, duplicate order notifications, etc.

The solution is to clear the “PayPal Identity Token” field in the PayPal gateway settings:

WooCommerce -> Settings -> Payments -> PayPal -> PayPal identity token

This is an unfixed bug in WooCommerce discussed in different places:

https://github.com/woocommerce/woocommerce/issues/13963
https://wordpress.org/support/topic/help-with-duplicate-new-order-emails/
https://wordpress.org/support/topic/woocommerce-stock-reducing-twice-after-processing-and-completed/