Merge branch 'trunk' into PCP-951-could-not-retrieve-order

This commit is contained in:
emilicastells 2022-12-05 11:18:09 +01:00
commit c654786ee3
No known key found for this signature in database
GPG key ID: 1520C07081754570
11 changed files with 66 additions and 37 deletions

View file

@ -168,7 +168,7 @@ return array(
CreditCardGateway::ID,
PayUponInvoiceGateway::ID,
CardButtonGateway::ID,
OXXOGateway::ID .
OXXOGateway::ID,
Settings::PAY_LATER_TAB_ID,
),
true

View file

@ -81,12 +81,12 @@ class OXXO {
add_filter(
'woocommerce_thankyou_order_received_text',
/**
* Order can be null.
* Param types removed to avoid third-party issues.
*
* @psalm-suppress MissingClosureParamType
*/
function( string $message, $order ) {
if ( ! $order instanceof WC_Order ) {
function( $message, $order ) {
if ( ! is_string( $message ) || ! $order instanceof WC_Order ) {
return $message;
}
@ -105,7 +105,16 @@ class OXXO {
add_action(
'woocommerce_email_before_order_table',
function ( WC_Order $order, bool $sent_to_admin ) {
/**
* Param types removed to avoid third-party issues.
*
* @psalm-suppress MissingClosureParamType
*/
function ( $order, $sent_to_admin ) {
if ( ! is_a( $order, WC_Order::class ) || ! is_bool( $sent_to_admin ) ) {
return;
}
if (
! $sent_to_admin
&& $order->get_payment_method() === OXXOGateway::ID