mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 04:58:28 +08:00
Refactor preview id determination
This commit is contained in:
parent
27768fdeda
commit
a3fec63153
1 changed files with 1 additions and 2 deletions
|
@ -314,7 +314,7 @@ document.addEventListener(
|
|||
|
||||
paypalButtonLocations.forEach((location) => {
|
||||
const inputNamePrefix = location === 'checkout' ? '#ppcp-button' : '#ppcp-button_' + location;
|
||||
let wrapperName = location.charAt(0).toUpperCase() + location.slice(1);
|
||||
const wrapperName = location.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join('');
|
||||
const fields = {
|
||||
'color': inputNamePrefix + '_color',
|
||||
'shape': inputNamePrefix + '_shape',
|
||||
|
@ -325,7 +325,6 @@ document.addEventListener(
|
|||
|
||||
if (location === 'mini-cart') {
|
||||
fields['height'] = inputNamePrefix + '_height';
|
||||
wrapperName = 'MiniCart';
|
||||
}
|
||||
|
||||
createButtonPreview(() => getButtonSettings('#ppcp' + wrapperName + 'ButtonPreview', fields));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue