Skip to content

Commit

Permalink
Prevent calling wc_gzd_send_instant_order_confirmation for refunds wh…
Browse files Browse the repository at this point in the history
…ile de-queuing confirmation emails.
  • Loading branch information
dennisnissle committed Jan 22, 2024
1 parent 7feae56 commit fc9b1fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion includes/class-wc-gzd-emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ public function get_gateways_disabling_paid_for_order_mail() {
public function maybe_prevent_queued_confirmation_email_sending( $send, $filter, $args ) {
if ( isset( $args[0] ) && is_numeric( $args[0] ) ) {
if ( $order = wc_get_order( absint( $args[0] ) ) ) {
if ( wc_gzd_send_instant_order_confirmation( $order ) ) {
if ( is_a( $order, 'WC_Order' ) && wc_gzd_send_instant_order_confirmation( $order ) ) {
$this->prevent_confirmation_email_sending();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function after_plugins_loaded() {
add_filter(
'woocommerce_gzd_instant_order_confirmation',
function( $send_confirmation, $order = null ) {
if ( $order && 'ppcp-pay-upon-invoice-gateway' === $order->get_payment_method() ) {
if ( is_a( $order, 'WC_Order' ) && 'ppcp-pay-upon-invoice-gateway' === $order->get_payment_method() ) {
$send_confirmation = false;
}

Expand Down

0 comments on commit fc9b1fa

Please sign in to comment.