How To Add Invoice Prefix to WooCommerce PayPal Pro Payment Gateway to Solve Duplicate Invoice ID supplied Error
If you are using WooCommerce PayPal Pro Payment Gateway on multiple websites you might experience “Duplicate Invoice ID Supplied” error.
There are really two ways how you can solve that problem.
1st – Modify your PayPal settings (not the best option).
2nd – Add unique “invoice prefix” (best option).
In order for you to be able to accept multiple payments for the same invoice you need to turn that setting on in your PayPal account.
To do so go to:
Click “Update” next to block payments
Select “No” under Block accidental payments: You may prevent accidental payments by blocking duplicate invoice IDs
Done! Now you can accept multiple payments for the same invoice.
Now, the option that we suggest is adding a “unique invoice prefix” for each of the websites that you are using WooCommerce PayPal Pro Payment Gateway on.
To do so go to “Plugin Editor”: in your WordPress Admin Menu
'INVNUM' => "Your-Prefix-Here" . $this->order->get_order_number(),
Done! Now your invoice will have custom invoice prefix and you no longer should be getting Duplicate Invoice ID Error.