mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +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 hasVaultedPaypal =
|
||||
PayPalCommerceGateway.vaulted_paypal_email !== '';
|
||||
const useSmartButtons = this.renderer.useSmartButtons ?? true;
|
||||
|
||||
const paypalButtonWrappers = {
|
||||
...Object.entries( PayPalCommerceGateway.separate_buttons ).reduce(
|
||||
|
@ -225,7 +226,8 @@ class CheckoutBootstap {
|
|||
this.standardOrderButtonSelector,
|
||||
( isPaypal && isFreeTrial && hasVaultedPaypal ) ||
|
||||
isNotOurGateway ||
|
||||
isSavedCard,
|
||||
isSavedCard ||
|
||||
( isPaypal && ! useSmartButtons ),
|
||||
'ppcp-hidden'
|
||||
);
|
||||
setVisible( '.ppcp-vaulted-paypal-details', isPaypal );
|
||||
|
|
|
@ -28,6 +28,18 @@ class Renderer {
|
|||
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(
|
||||
contextConfig,
|
||||
settingsOverride = {},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue