Merge pull request #899 from woocommerce/PCP-878-fatal-error-caused-by-oxxo-code

Fix thankyou_order_received filter usage
This commit is contained in:
Emili Castells 2022-10-13 10:50:46 +02:00 committed by GitHub
commit 74bc941699
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -80,7 +80,16 @@ class OXXO {
add_filter(
'woocommerce_thankyou_order_received_text',
function( string $message, WC_Order $order ) {
/**
* Order can be null.
*
* @psalm-suppress MissingClosureParamType
*/
function( string $message, $order ) {
if ( ! $order instanceof WC_Order ) {
return $message;
}
$payer_action = $order->get_meta( 'ppcp_oxxo_payer_action' ) ?? '';
$button = '';