♻️ Restore correct order of payload creation

The token must be added after the last filter, to maintain backwards compatibility!
This commit is contained in:
Philipp Stracker 2025-03-05 15:27:43 +01:00
parent 8cb66440d3
commit 54046cd307
No known key found for this signature in database

View file

@ -67,7 +67,6 @@ class PartnerReferralsData {
'woocommerce_paypal_payments_partner_config_override_return_url', 'woocommerce_paypal_payments_partner_config_override_return_url',
admin_url( 'admin.php?page=wc-settings&tab=checkout&section=ppcp-gateway' ) admin_url( 'admin.php?page=wc-settings&tab=checkout&section=ppcp-gateway' )
); );
$return_url = add_query_arg( array( 'ppcpToken' => $onboarding_token ), $return_url );
/** /**
* Filter the label of the "Return to your shop" button. * Filter the label of the "Return to your shop" button.
@ -118,8 +117,16 @@ class PartnerReferralsData {
); );
/** /**
* Returns the partners referrals data. * Filter the final partners referrals data collection.
*/ */
return apply_filters( 'ppcp_partner_referrals_data', $payload ); $payload = apply_filters( 'ppcp_partner_referrals_data', $payload );
// Add the nonce in the end, to maintain backwards compatibility of filters.
$payload['partner_config_override']['return_url'] = add_query_arg(
array( 'ppcpToken' => $onboarding_token ),
$payload['partner_config_override']['return_url']
);
return $payload;
} }
} }