mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🐛 Show PayPal payment button in ACDC-only mode
When only using ACDC without smart buttons, this commit makes the default “Proceed to PayPal” button visible
This commit is contained in:
parent
47b57058fb
commit
5e4157d488
2 changed files with 15 additions and 1 deletions
|
@ -211,6 +211,7 @@ class CheckoutBootstap {
|
||||||
const isFreeTrial = PayPalCommerceGateway.is_free_trial_cart;
|
const isFreeTrial = PayPalCommerceGateway.is_free_trial_cart;
|
||||||
const hasVaultedPaypal =
|
const hasVaultedPaypal =
|
||||||
PayPalCommerceGateway.vaulted_paypal_email !== '';
|
PayPalCommerceGateway.vaulted_paypal_email !== '';
|
||||||
|
const useSmartButtons = this.renderer.useSmartButtons ?? true;
|
||||||
|
|
||||||
const paypalButtonWrappers = {
|
const paypalButtonWrappers = {
|
||||||
...Object.entries( PayPalCommerceGateway.separate_buttons ).reduce(
|
...Object.entries( PayPalCommerceGateway.separate_buttons ).reduce(
|
||||||
|
@ -225,7 +226,8 @@ class CheckoutBootstap {
|
||||||
this.standardOrderButtonSelector,
|
this.standardOrderButtonSelector,
|
||||||
( isPaypal && isFreeTrial && hasVaultedPaypal ) ||
|
( isPaypal && isFreeTrial && hasVaultedPaypal ) ||
|
||||||
isNotOurGateway ||
|
isNotOurGateway ||
|
||||||
isSavedCard,
|
isSavedCard ||
|
||||||
|
( isPaypal && ! useSmartButtons ),
|
||||||
'ppcp-hidden'
|
'ppcp-hidden'
|
||||||
);
|
);
|
||||||
setVisible( '.ppcp-vaulted-paypal-details', isPaypal );
|
setVisible( '.ppcp-vaulted-paypal-details', isPaypal );
|
||||||
|
|
|
@ -28,6 +28,18 @@ class Renderer {
|
||||||
this.reloadEventName = 'ppcp-reload-buttons';
|
this.reloadEventName = 'ppcp-reload-buttons';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine is PayPal smart buttons are used by inspecting the existing plugin configuration:
|
||||||
|
* If the url-param "components" contains a "buttons" element, smart buttons are enabled.
|
||||||
|
*
|
||||||
|
* @return {boolean} True, if smart buttons are present on the page.
|
||||||
|
*/
|
||||||
|
get useSmartButtons() {
|
||||||
|
const components = this.defaultSettings?.url_params?.components || '';
|
||||||
|
|
||||||
|
return components.split( ',' ).includes( 'buttons' );
|
||||||
|
}
|
||||||
|
|
||||||
render(
|
render(
|
||||||
contextConfig,
|
contextConfig,
|
||||||
settingsOverride = {},
|
settingsOverride = {},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue