Add target customer id when creating id token

This commit is contained in:
Emili Castells Guasch 2023-10-20 16:46:02 +02:00
parent ffb279115c
commit b07ac130dc
2 changed files with 19 additions and 3 deletions

View file

@ -57,7 +57,12 @@ class SavePaymentMethodsModule implements ModuleInterface {
assert( $api instanceof UserIdToken );
try {
$id_token = $api->id_token();
$target_customer_id = '';
if ( get_current_user_id() !== 0 ) {
$target_customer_id = get_user_meta( get_current_user_id(), '_ppcp_target_customer_id', true );
}
$id_token = $api->id_token( $target_customer_id );
$localized_script_data['save_payment_methods'] = array(
'id_token' => $id_token,
);