mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Check that wc session exists before using it
This commit is contained in:
parent
b549f71d77
commit
ad523e0973
1 changed files with 5 additions and 1 deletions
|
@ -107,7 +107,11 @@ class VaultingModule implements ModuleInterface {
|
|||
add_action(
|
||||
'woocommerce_created_customer',
|
||||
function( int $customer_id ) use ( $subscription_helper ) {
|
||||
$guest_customer_id = WC()->session->get( 'ppcp_guest_customer_id' );
|
||||
$session = WC()->session;
|
||||
if ( ! $session ) {
|
||||
return;
|
||||
}
|
||||
$guest_customer_id = $session->get( 'ppcp_guest_customer_id' );
|
||||
if ( $guest_customer_id && $subscription_helper->cart_contains_subscription() ) {
|
||||
update_user_meta( $customer_id, 'ppcp_guest_customer_id', $guest_customer_id );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue