Ecommerce Shopify WordPress Discussion

How to refresh stock availability after variant changes on Shopify?

On Shopify, I got this code to display available quantities in stock with a pretty visual effect on product page, but it don't refresh on product with variants. I'm looking for a way to update stock availibility after variant changes, based on this code (without refreshing the page). Refresh Stock Availability After Variant Changes {% assign current_variant = product.selected_or_first_available_variant %} <div class="instock-pulse"> {% if current_variant.available %} {% if current_variant.inventory_quantity > 0 %}<span class="icon--pulsing"></span>{{ current_variant.inventory_quantity }} pieces in stock {% endif %} {% endif %} </div>
You'd need to hook into the variant update function in the JavaScript and then update that span with the current variants inventory amount. Liquid is compiled on the server, so any updates to the page need to be made with JS

December 30, 2023

If you are using Dawn Theme you can easily do that by just using your code snippet in the correct place. As Dawn theme is updating HTML using ajax. If you are using another theme then we need to check and if it's updated by js, if so then we need to write js code to update variant Stock. (you can share access of store i can help you with it if needed) Expected output if any doubt please comment.

December 30, 2023

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.