Skip to content

Commit 233e4c5

Browse files
committed
Disabling "Display on Product Details Page" the button is shown anyway.
1 parent f3d7a0d commit 233e4c5

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

app/code/Magento/Paypal/Model/SmartButtonConfig.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public function getConfig(string $page): array
6767
'locale' => $this->localeResolver->getLocale(),
6868
'allowedFunding' => $this->getAllowedFunding($page),
6969
'disallowedFunding' => $this->getDisallowedFunding(),
70-
'styles' => $this->getButtonStyles($page)
70+
'styles' => $this->getButtonStyles($page),
71+
'isVisibleOnProductPage' => (int)$this->config->getValue('visible_on_product')
7172
];
7273
}
7374

app/code/Magento/Paypal/Test/Unit/Model/_files/expected_config.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
'shape' => 'pillow',
3232
'label' => 'installment',
3333
'installmentperiod' => 0
34-
]
34+
],
35+
'isVisibleOnProductPage' => 0
3536
]
3637
],
3738
'checkout' => [
@@ -59,7 +60,8 @@
5960
'shape' => 'pillow',
6061
'label' => 'installment',
6162
'installmentperiod' => 0
62-
]
63+
],
64+
'isVisibleOnProductPage' => 0
6365
]
6466
],
6567
'mini_cart' => [
@@ -86,7 +88,8 @@
8688
'color' => 'gold',
8789
'shape' => 'rect',
8890
'label' => 'paypal'
89-
]
91+
],
92+
'isVisibleOnProductPage' => 0
9093
]
9194
],
9295
'mini_cart' => [
@@ -113,7 +116,8 @@
113116
'color' => 'gold',
114117
'shape' => 'rect',
115118
'label' => 'paypal'
116-
]
119+
],
120+
'isVisibleOnProductPage' => 0
117121
]
118122
],
119123
'product' => [
@@ -140,7 +144,8 @@
140144
'color' => 'gold',
141145
'shape' => 'rect',
142146
'label' => 'paypal',
143-
]
147+
],
148+
'isVisibleOnProductPage' => 0
144149
]
145150
]
146151
];

app/code/Magento/Paypal/view/frontend/web/js/in-context/product-express-checkout.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ define([
2424
customer = customerData.get('customer');
2525

2626
this._super();
27-
this.renderPayPalButtons(element);
27+
28+
if (config.clientConfig.isVisibleOnProductPage) {
29+
this.renderPayPalButtons(element);
30+
}
31+
2832
this.declinePayment = !customer().firstname && !cart().isGuestCheckoutAllowed;
2933

3034
return this;

0 commit comments

Comments
 (0)