Merge pull request #655 from woocommerce/PCP-694-smart-button-not-visible-on-single-product-page

Convert the "," separator into "." before checking the price amount.
This commit is contained in:
Emili Castells 2022-06-14 11:55:26 +02:00 committed by GitHub
commit 4ff581a5f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,6 +53,8 @@ class SingleProductBootstap {
else if (document.querySelector('.product .woocommerce-Price-amount')) {
priceText = document.querySelector('.product .woocommerce-Price-amount').innerText;
}
priceText = priceText.replace(/,/g, '.');
const amount = parseFloat(priceText.replace(/([^\d,\.\s]*)/g, ''));
return amount === 0;