Jump to content

Scarcity text label customize

Recommended Posts

  • Replies 1
  • Views 223
  • Created
  • Last Reply
49 minutes ago, Hozzanator said:

Site URL: https://www.pcupgrade.org/competition/8rg4ap6i7a84ojl8alljljnsitsg3o-wddar-wdzta-9f6dt-c8dak

I am trying to customize the scarcity text from say "only 150 left in stock" to "only 150 tickets left" or anything else I like really.  The custom label is no good as it doesn't add the quantity of items.  can anyone helps with this please?

Could you try this method, kindly move the placeholde {remain} anywhere in the string

var scarcityMessage = "Only {remain} tickets left";
window.Squarespace.onInitialize(Y, function() {
		if (document.querySelector(".product-scarcity")) {
            var text = document.querySelector(".product-scarcity").innerText;
            var remain = text.match("Only (.*) left");
            if (remain) {
                remain = remain[1];

            document.querySelector(".product-scarcity").innerText = scarcityMessage.replace("{remain}", remain);


BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!


Link to comment


This topic is now archived and is closed to further replies.

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.