Price refresh script (Is it required)??

Highlighted
New Member
5 0 0

Hi all,

 

I am using the Minimal theme.

 

I have installed the shopify currencies picker by following this tutorial:

https://help.shopify.com/en/themes/customization/currencies

 

I then setup wholesale discounts without an app using this tutorial:

https://www.envision.io/blogs/ecommerce-pulse/80312001-how-to-add-a-wholesale-area-to-your-shopify-s...

 

All worked perfectly with the exception of the price shown on the Product Page.

The wholesale altered price would only flash up for a second and then revert back to the original unmodified product price.

 

After much searching I found that the culprit was a small piece of script in the theme.js file:

 

// Regardless of stock, update the product price
 this.selectors.$productPrice.html(
 Shopify.formatMoney(variant.price, moneyFormat)
 );

 

I commented this out and the price now stays modified on the Product Page and seems to show up fine everywhere all the way through to the checkout.

 

My questions are:

1) Is this piece of code required for anything that I am missing?

2) Will removing it cause any behind the scenes issues?

3) What is this code for?  Why would the price need refreshing via Javascript?

 

Thanks for your help and comments.

0 Likes