baselbers / woocommerce-pdf-invoices

Automatically generate and attach customizable PDF Invoices to WooCommerce emails and connect with Dropbox, Google Drive, OneDrive or Egnyte.

Home Page:http://wcpdfinvoices.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Credit Note email sent twice

DoreenChan opened this issue · comments

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.

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.