Java Math Equations don't work in shopify liquid

I’m trying to create a table that uses Java for discount pricing. I can grab the number just fine and insert it into the table but the math equation fails when implemented into the shopify page.

Any help would be much appreciated thanks.

The code below works in a regular .html document but doesn’t work in shopify. I get NaN.

$200

Volume Discounts

Buy Save You Pay
2-3 20% off
4-9 30% off
10-24 40% off
25-49 50% off
50-99 60% off

I tested this in liquid and did not have any issues. Can you share a preview link of the issue?

1 Like

Page link here
https://nationalsignsource.com/collections/customizable-signs/products/rectangle-stickers-customize-it

[image: image.png]

1 Like

The element you are selecting for the price contains additional html. Try a more specific selector:

var price = document.querySelector('#productPrice-alternate2 > span').innerText
2 Likes