Closed DoreenChan closed 6 years ago
I do not get any duplicate emails. Code seems fine to me to since it is only triggering the email when the action is 'send_customer_credit_note'. Action is getting triggered when sending email within the edit order page.
Hi,
Credit note trigger from the 'Order action' by admin will sent twice to customer, this might cause by 2 $_POST actions will be trigger by 'Update' button being clicked.
After dig into the 'send_credit_note' function, found that duplicate email can be avoid by checking the 'post_id' instead of 'post_ID'.
if (empty($_POST['wc_order_action']) || empty($_POST['post_id'])) { // @codingStandardsIgnoreLine return; }
instead of
if ( empty( $_POST['wc_order_action'] ) || empty( $_POST['post_ID'] ) ) { // @codingStandardsIgnoreLine return; }
Please do have a check. Thanks.