mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Handle price suffix with price for product button check
This commit is contained in:
parent
91c39fdef2
commit
3d096fb2ad
1 changed files with 7 additions and 2 deletions
|
@ -69,8 +69,13 @@ class SingleProductBootstap {
|
|||
() => {
|
||||
const priceEl = document.querySelector('.product .woocommerce-Price-amount');
|
||||
// variable products show price like 10.00 - 20.00 here
|
||||
if (priceEl && priceEl.parentElement.querySelectorAll('.woocommerce-Price-amount').length === 1) {
|
||||
return priceEl.innerText;
|
||||
// but the second price also can be the suffix with the price incl/excl tax
|
||||
if (priceEl) {
|
||||
const allPriceElements = Array.from(priceEl.parentElement.querySelectorAll('.woocommerce-Price-amount'))
|
||||
.filter(el => !el.parentElement.classList.contains('woocommerce-price-suffix'));
|
||||
if (allPriceElements.length === 1) {
|
||||
return priceEl.innerText;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue