mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Revert "enqueue PayPal script from backend"
This reverts commit 238a71f9a4
.
This commit is contained in:
parent
daf7caf9f4
commit
1ce5e27f37
2 changed files with 23 additions and 10 deletions
|
@ -73,6 +73,27 @@ const bootstrap = () => {
|
|||
document.addEventListener(
|
||||
'DOMContentLoaded',
|
||||
() => {
|
||||
bootstrap();
|
||||
if (!typeof (PayPalCommerceGateway)) {
|
||||
console.error('PayPal button could not be configured.');
|
||||
return;
|
||||
}
|
||||
const script = document.createElement('script');
|
||||
|
||||
script.addEventListener('load', (event) => {
|
||||
bootstrap();
|
||||
});
|
||||
script.setAttribute('src', PayPalCommerceGateway.button.url);
|
||||
Object.entries(PayPalCommerceGateway.script_attributes).forEach(
|
||||
(keyValue) => {
|
||||
script.setAttribute(keyValue[0], keyValue[1]);
|
||||
}
|
||||
);
|
||||
|
||||
if (PayPalCommerceGateway.data_client_id.set_attribute) {
|
||||
dataClientIdAttributeHandler(script, PayPalCommerceGateway.data_client_id);
|
||||
return;
|
||||
}
|
||||
|
||||
document.body.append(script);
|
||||
},
|
||||
);
|
||||
|
|
|
@ -351,19 +351,11 @@ class SmartButton implements SmartButtonInterface {
|
|||
wp_enqueue_script(
|
||||
'ppcp-smart-button',
|
||||
$this->module_url . '/assets/js/button.js',
|
||||
array( 'jquery', 'ppcp-paypal-buttons' ),
|
||||
array( 'jquery' ),
|
||||
1,
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'ppcp-paypal-buttons',
|
||||
$this->url(),
|
||||
array('jquery'),
|
||||
null,
|
||||
false
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
'ppcp-smart-button',
|
||||
'PayPalCommerceGateway',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue