When a product sells out, a helpful message can keep shoppers informed and encourage them to check back later. With a little Shopify Liquid, you can show a custom message whenever a product is unavailable, instead of relying on the default sold-out notice.
This guide walks you through adding a Shopify sold out product custom message Liquid snippet to your store. You can tailor the wording to match your brand, let customers know what to do next, and create a smoother shopping experience—even when an item is out of stock.
Shopify sold out product custom message Liquid: Choose the right message and placement
Once you know an item is unavailable, the next question is what a shopper should do with that information. A thoughtful message can turn a dead end into a useful next step, while its placement determines whether customers notice it at the right moment.
Before adding the Liquid logic, decide which situation your message needs to address and where it belongs on the product page. These choices will help your Shopify sold out product custom message Liquid feel helpful rather than like a generic error.
Start with the customer’s most likely question: is the item coming back, and what can they do now? Keep the answer direct, then offer one practical action. If restock timing is uncertain, avoid promising a date; clear expectations build more trust than an estimate that may change.
Match the wording to your inventory situation. For example, a temporary stockout can invite shoppers to sign up for a restock alert, while a discontinued product may call for a link to a similar item. Useful options include:
- Restocking soon: “Temporarily sold out—sign up to hear when it’s back.”
- Restock date unknown: “Currently unavailable. Check back soon or browse similar styles.”
- No further stock planned: “This item has been discontinued. Explore our alternatives.”
Also consider whether availability changes by variant. A product may have several sizes or colors, with only one option sold out. In that case, show the custom message when the selected variant is unavailable, rather than suggesting the entire product is gone. This distinction helps prevent confusion and keeps available options easy to find.
Placement matters just as much as phrasing. Put the message near the sold-out button or variant selector, where shoppers are already deciding whether to buy. If the notice appears far below the product details, customers may miss it; if it replaces the entire page, they lose useful information and alternatives. Keep the product description and images visible, and make any next step—such as a restock link—easy to spot.
Add a custom sold-out message with Shopify Liquid
The message is planned and placed; now it’s time to connect it to the store’s availability data. A small Liquid condition can show the right notice, while leaving your theme’s product form and purchase controls intact.
Check product and variant availability in your theme
Before editing the template, decide whether the notice should appear when every variant is sold out or only when the shopper’s selected option is unavailable. That distinction matters for products where, for example, one size is gone but other sizes can still be purchased.
For a selected-variant message, assign the current variant and check its available property. Place this near the product’s purchase area, adjusting the wording to suit your store:
{% assign currentvariant = product.selectedvariant | default: product.selectedorfirstavailablevariant %}
{% unless current_variant.available %}
<p class="productsold-out-message" role="status">
This option is currently sold out. Check back soon or explore similar products.
</p>
{% endunless %}If your message should appear only when the whole product is unavailable, use {% unless product.available %} instead. Liquid renders the condition when the page loads; when shoppers change variants, your theme’s existing variant-selection JavaScript may need to refresh the message too. Test both available and sold-out options to confirm it stays in sync.
Update the product template while preserving the add-to-cart behavior
Once you’ve chosen the correct availability check, locate the product template or section that contains the variant selector and purchase button. Theme file names vary, so look for the product form or the add-to-cart button in your theme’s code editor rather than assuming a particular filename.
Add the message beside the purchase controls, but keep the existing product form, variant ID input, and button markup. Those elements handle variant submission and theme-specific behaviors such as cart updates; replacing them with a new form can disrupt the buying flow. If your theme already disables the button for unavailable variants, leave that logic in place and treat the custom notice as an additional explanation.
- Preview a product with all variants available.
- Test a product with one sold-out variant and one available variant.
- Check a fully sold-out product, then confirm the notice appears in the intended location on mobile and desktop.
This approach gives your Shopify sold out product custom message Liquid a clear connection to inventory status without removing the theme’s existing purchase behavior.
Refine and test your Shopify sold out product custom message Liquid
A notice can be technically correct and still feel out of place if its wording, timing, or styling clashes with the rest of the product page. A few refinements—and a careful test across different inventory states—help make the experience feel intentional.
First, consider how the message should reflect your brand while staying accurate as stock changes. The following adjustments can help you avoid a one-size-fits-all notice.
Match the message to your store’s style and inventory needs
Keep the tone consistent with your product descriptions and support language. A friendly store might say, “This favorite is taking a short break,” while a more direct brand could use, “Currently unavailable.” In either case, pair the wording with a clear, realistic next step and don’t imply a restock is guaranteed unless you know it is.
If different products have different restock plans, avoid hard-coding one promise into every notice. You can store product-specific wording in a Shopify metafield and render that value in your theme, with a sensible fallback for products where no custom text is set. This makes updates easier for staff who don’t edit Liquid and helps prevent outdated promises from lingering.
Style the notice so it’s easy to find without competing with the product title or primary controls. Use your theme’s existing text and spacing conventions, and make sure the message remains readable with sufficient contrast. A distinct icon can help, but don’t rely on color alone to communicate that an option is unavailable.
Once the copy and presentation are settled, test how the notice behaves as inventory and variant selections change. A short checklist can catch issues that a quick visual scan might miss.
Test sold-out, available, and variant-specific products before publishing
Preview the change with products representing each availability state—not just the item you used while editing. Check both the storefront preview and the live theme on desktop and mobile, since theme scripts and layouts can behave differently at smaller widths.
During testing, verify that the message updates when a shopper switches between available and sold-out variants. If it stays visible after selecting an available option, or disappears for an unavailable one, the theme’s variant-change behavior may need to update the notice alongside the purchase button. Also confirm that the right wording appears for products with a restock message and those using the fallback.
- Available product: no sold-out notice appears.
- Partially unavailable product: the notice follows the selected variant.
- Fully sold-out product: the intended message appears, and purchase controls behave as expected.
- Small screen: the notice is readable and doesn’t obscure product options.
After publishing, repeat a quick check whenever you change the product form or variant-selection code. That final habit helps keep your Shopify sold out product custom message Liquid accurate as your theme evolves.
Turn sold-out moments into clearer next steps
A custom sold-out message helps shoppers understand what’s happening and what they can do next. With Shopify Liquid, you can show the right notice for an unavailable product or selected variant, place it where customers need it, and keep your theme’s existing purchase behavior intact.
Thoughtful wording, accurate availability checks, and a little styling make the message feel like a natural part of your store—not a dead end. Before publishing, test available, sold-out, and variant-specific products on both desktop and mobile, then check again when you update your theme. A small improvement can make an out-of-stock moment more helpful and keep shoppers moving through your store.