Adding variant price to add to cart button on product page

Hi there

I’m trying to modify the product page “add to cart” button using Debut them, to always show the current selected variant price within the add to cart button itself. See here.

So instead of the button text being “Add to cart” it might be “Add to cart | $14” and when the other variant is selected, it updates to “Add to cart | $44

It would also be nice to format the number to round it to the nearest decimal. So prices would display like $14, $14.5 and $14.95 as examples - as opposed to $14.00 or $14.50 if these were prices.

Does anyone have any feedback on how to achieve this? Thanks!

Hello @mayb ,

Yes it’s possible.
You have to use the same callback function which main price is using.
Check main price when variant changes it updates automatically so if you need same with atc button you have to follow same code with some modification.

Thanks

1 Like

Hi Guleria

Thanks for this. I’m not too experienced with modifying Shopify to this extent. Is this something you do as a contractor?

Yes please drop an email with the details.

1 Like