mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge pull request #1770 from woocommerce/PCP-798-paylater-locations
Improve Pay Later messages and add Shop, Home locations
This commit is contained in:
commit
814c9fcd36
10 changed files with 474 additions and 75 deletions
|
@ -156,8 +156,15 @@ class CheckoutBootstap {
|
|||
}
|
||||
|
||||
shouldShowMessages() {
|
||||
return getCurrentPaymentMethod() === PaymentMethods.PAYPAL
|
||||
&& !PayPalCommerceGateway.is_free_trial_cart;
|
||||
// hide when another method selected only if messages are near buttons
|
||||
const messagesWrapper = document.querySelector(this.gateway.messages.wrapper);
|
||||
if (getCurrentPaymentMethod() !== PaymentMethods.PAYPAL &&
|
||||
messagesWrapper && jQuery(messagesWrapper).closest('.ppc-button-wrapper').length
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !PayPalCommerceGateway.is_free_trial_cart;
|
||||
}
|
||||
|
||||
disableCreditCardFields() {
|
||||
|
|
|
@ -28,15 +28,9 @@ class MessageRenderer {
|
|||
return;
|
||||
}
|
||||
|
||||
const newWrapper = document.createElement('div');
|
||||
newWrapper.setAttribute('id', this.config.wrapper.replace('#', ''));
|
||||
const wrapper = document.querySelector(this.config.wrapper);
|
||||
this.currentNumber++;
|
||||
newWrapper.setAttribute('data-render-number', this.currentNumber);
|
||||
|
||||
const oldWrapper = document.querySelector(this.config.wrapper);
|
||||
const sibling = oldWrapper.nextSibling;
|
||||
oldWrapper.parentElement.removeChild(oldWrapper);
|
||||
sibling.parentElement.insertBefore(newWrapper, sibling);
|
||||
wrapper.setAttribute('data-render-number', this.currentNumber);
|
||||
|
||||
widgetBuilder.registerMessages(this.config.wrapper, options);
|
||||
widgetBuilder.renderMessages(this.config.wrapper);
|
||||
|
|
|
@ -84,11 +84,14 @@ class WidgetBuilder {
|
|||
return;
|
||||
}
|
||||
|
||||
const entry = this.messages.get(wrapper);
|
||||
|
||||
if (this.hasRendered(wrapper)) {
|
||||
const element = document.querySelector(wrapper);
|
||||
element.setAttribute('data-pp-amount', entry.options.amount);
|
||||
return;
|
||||
}
|
||||
|
||||
const entry = this.messages.get(wrapper);
|
||||
const btn = this.paypal.Messages(entry.options);
|
||||
|
||||
btn.render(entry.wrapper);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue