Automatically Remove Sold Out Items
Pin this post to Pinterest! ☝🏻
Updated 9/3/25 to reflect Squarespace’s updated product-list markup
automatically remove sold out items
There's nothing worse than having a whole store full of items that say "sold out".
Customers shouldn't have to scroll through a list of items that aren't available for purchase. This is a really fast way to make them leave your ecommerce site and go somewhere else. It's really frustrating to the customer when you sell unique items (like paintings) and the item they want is sold out.
It's like going to the bakery and asking for a chocolate croissant.
"We're out."
"Ok... what about a cherry danish?"
"We're out."
"Ok... let's try a blueberry muffin."
"We're out."
"Well then what DO you have?!"
As of now, once you sell out of an item, it stays on your website with the words "sold out". Unfortunately, Squarespace doesn't automatically remove the item from your store. (Why?!?! 😩)
However, Squarespace does give you the option to manually remove an item by editing the item and changing the visibility to "hidden". If you’re making multiple sales a day (or even a week), that can quickly add up to a lot of time you’re wasting.
Thankfully, there's a way for items to automatically be hidden once they are sold out.
Also - if you have digital products, they never sell out since there's an indefinite amount. But if you're selling unique physical items, then that quantity is going to hit "0" as soon as you make a sale. And good for you!
THE CODE you need
Updated 9/3/25 to reflect Squarespace’s updated product-list markup
Log into your site and go to Pages -> Custom Code -> Code Injection
Then paste this code in the FOOTER section.
<script> document.addEventListener('DOMContentLoaded', function () { // Remove any product card whose wrapper carries the "sold-out" class document.querySelectorAll( '.product-list-item.sold-out, .products-list-item.sold-out, .grid-item.sold-out, .ProductList-item.sold-out' ).forEach(function (el) { el.setAttribute('aria-hidden','true'); el.style.display = 'none'; }); }); </script>
Hit Save and you're all set!
Now you should have a beautiful store that displays all of your items that are in stock -