mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Fix the intent value for single products.
This commit is contained in:
parent
036e7d0c33
commit
b15c03d418
1 changed files with 4 additions and 4 deletions
|
@ -887,6 +887,8 @@ class SmartButton implements SmartButtonInterface {
|
||||||
*/
|
*/
|
||||||
private function url(): string {
|
private function url(): string {
|
||||||
$intent = ( $this->settings->has( 'intent' ) ) ? $this->settings->get( 'intent' ) : 'capture';
|
$intent = ( $this->settings->has( 'intent' ) ) ? $this->settings->get( 'intent' ) : 'capture';
|
||||||
|
$product_intent = $this->subscription_helper->current_product_is_subscription() ? 'authorize' : $intent;
|
||||||
|
$other_context_intent = $this->subscription_helper->cart_contains_subscription() ? 'authorize' : $intent;
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'client-id' => $this->client_id,
|
'client-id' => $this->client_id,
|
||||||
|
@ -895,9 +897,7 @@ class SmartButton implements SmartButtonInterface {
|
||||||
'components' => implode( ',', $this->components() ),
|
'components' => implode( ',', $this->components() ),
|
||||||
'vault' => $this->can_save_vault_token() ? 'true' : 'false',
|
'vault' => $this->can_save_vault_token() ? 'true' : 'false',
|
||||||
'commit' => is_checkout() ? 'true' : 'false',
|
'commit' => is_checkout() ? 'true' : 'false',
|
||||||
'intent' => ( $this->subscription_helper->cart_contains_subscription() || $this->subscription_helper->current_product_is_subscription() )
|
'intent' => $this->context() === 'product' ? $product_intent : $other_context_intent,
|
||||||
? 'authorize'
|
|
||||||
: $intent,
|
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
$this->environment->current_environment_is( Environment::SANDBOX )
|
$this->environment->current_environment_is( Environment::SANDBOX )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue