Ad

After Variant Save, Update The Price In StoreFront Shopify

- 1 answer

I have a Ruby on Rails Heroku APP that Update the price using an external API, that works perfectly!

After I update the price with:

@variant.price = xx
@vatiant.save

The variant Price Update, but to see the price in the Product Page, I have to completely refresh the Page.

I want to know if there's a way to Update the Price with Jquery or Something.

Right now I have an Iframe that shows the Price from the View/Controller in the APP.

You can see it on any product on: www.lovegigio.com

Thanks! Cesar Rodriguez

Ad

Answer

You will need to have some mechanism to bind the price in the view to model so it updates when it changes.

I would poll your service for changes in the model, something that compares the existing price in the UI to the price in the server (maybe every 10 seconds)

and after it identifies the change, it calls to update the iframe:

document.getElementById('iframe_id').contentWindow.location.reload(true);
Ad
source: stackoverflow.com
Ad