mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Merge pull request #1234 from woocommerce/PCP-1483-price-suffix
Handle price suffix with price for product button check
This commit is contained in:
commit
9283c28bd1
1 changed files with 7 additions and 2 deletions
|
@ -69,9 +69,14 @@ 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) {
|
||||
// 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;
|
||||
},
|
||||
].map(f => f()).find(val => val);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue