We want to show pricing on the product page as: $68 (without any cents as they are all zeros). This works fine using $&mvt:product:price; for most products. However, we have a product that has to use inventory variants so that we can show a different image for each variant. When a variant is selected. the visible price changes from '$68' to '$68.00'. How could this be altered to keep the format of '68'?
Announcement
Collapse
No announcement yet.
Unformatted Price
Collapse
X
-
You might try using a conditional to check for the decimal point and, if present, pad two places to the right.Matt Zimmermann
Miva Web Developer
Alchemy Web Development
https://www.alchemywebdev.com
Site Development - Maintenance - Consultation
Miva Certified Developer
Miva Professional Developer
https://www.dev4web.net | Twitter
Comment
-
Since you're dealing with variants, you'll probably have to use JavaScript to make this happen. You would want to use "includes()" [ https://developer.mozilla.org/en-US/...tring/includes ] to check for the decimal and then "padEnd()" [ https://developer.mozilla.org/en-US/.../String/padEnd ] to add the trailing zero, if needed.Matt Zimmermann
Miva Web Developer
Alchemy Web Development
https://www.alchemywebdev.com
Site Development - Maintenance - Consultation
Miva Certified Developer
Miva Professional Developer
https://www.dev4web.net | Twitter
Comment
Comment