Emergency situation

In case of emergencies or breakdowns, you can send an SMS to our emergency hotline

On-call phone (SMS only)

+45 29 70 15 95

Send an SMS with the following information:

  • Your name and webshop
  • Description of the problem
  • Your callback phone number

Notes: This service is only for critical situations where your webshop is down or has serious problems. For regular support, please use our normal support channels.

Show variants not in stock

Guide to display out-of-stock variants in your Shoporama theme so customers can see the full range and sign up for stock alerts.

Reading time: approx. {eight} minutes
Shopejer Developer

If you have a product listing with, for example, six sizes, but only three are in stock, Shoporama will, by default, show only the three available ones. You can customize your theme so that all variants are displayed—including those that are out of stock—giving the customer a complete overview of the product range.

Default Behavior

By default, Shoporama only displays variants that are in stock. This prevents customers from selecting a size or color that cannot be delivered anyway. In the vast majority of stores, this works fine, but if you’re selling a collection where certain sizes are often out of stock, it can be advantageous to display all variants and simply mark those that aren’t currently available.

The correct methods in the theme

On a SafeProduct object, you have two methods you can call in your Smarty template:

  • $product->getInStockVariants() returns only variants that are in stock.
  • $product->getStockVariants($only_in_stock, $hide_stock) returns all variants. Set the first parameter to false to include both sold-out and available variants.

Both methods return an array of rows (not variant objects). Each row is an associative array with the following keys:

  • attr_name, the attribute’s name (e.g., “Size”)
  • attr_tag, the attribute’s tag (code-friendly name, e.g., “size”)
  • name, the variant value’s name (e.g., “M” or “Red”)
  • cnt, quantity in stock (0 if out of stock, null if you’ve chosen to hide stock quantities)
  • attribute_id and attribute_value_id, the IDs you use when adding the variant to the cart
  • weight, the sort order
  • price and sale_price, variant-specific price (if applicable)

Display all variants in the theme

Change to ` getStockVariants(false) ` in your product template. Example as a dropdown:

<select name="attribute[]">
  <{foreach $product->getStockVariants(false) as $variant}>
    <option value="<{$variant.attribute_value_id}>"
      <{if $variant.cnt <= 0}>disabled<{/if}>>
      <{$variant.name}><{if $variant.cnt <= 0}> (out of stock)<{/if}>
    </option>
  <{/foreach}>
</select>

Example of clickable buttons with visual indicators for out-of-stock options:

<{foreach $product->getStockVariants(false) as $variant}>
  <button type="button"
          data-attribute-id="<{$variant.attribute_id}>"
          data-attribute-value-id="<{$variant.attribute_value_id}>"
          class="variant-btn <{if $variant.cnt <= 0}>is-sold-out<{/if}>"
          <{if $variant.cnt <= 0}>disabled<{/if}>>
    <{$variant.name}>
  </button>
<{/foreach}>

Styling of Sold-Out Variants

  • Add the " disabled " attribute to sold-out options so they cannot be selected.
  • Visually mark them with a CSS class, such as a muted color, a strikethrough, or a diagonal line.
  • Display the text (out of stock) after the variant name so it’s clear to the customer.

Hide stock quantity

If you don’t want to reveal exactly how many are in stock (e.g., “only 2 left”), you can set the second parameter to true:

<{foreach $product->getStockVariants(false, true) as $variant}>
  ...
<{/foreach}>

Then $variant.cnt will be null for all variants, including those that are out of stock. Therefore, you cannot use cnt to determine whether a variant is out of stock when you hide the stock count.

Combine with stock notifications

For out-of-stock variants , you can offer customers the option to receive an email when the item is back in stock. This ensures that the customer doesn’t leave, even if the desired size or color is currently out of stock.

Tip: When customers can see the entire product range, the selection appears broader, which increases the likelihood that they’ll return when the item is back in stock.

Frequently Asked Questions

Should I display all sold-out variants for every product?

Not necessarily. It makes the most sense for fashion products with clear size categories (S, M, L), or when a collection typically sells out in certain sizes first. For very large product ranges, or for products where variants are often permanently discontinued, it can cause confusion.

Can a customer add a sold-out variant to their cart?

No. When the “disabled” attribute is set for an option, it cannot be selected. If you’re building custom JavaScript, you’ll need to block out-of-stock variants yourself so that a “Add to Cart” click doesn’t go through.

Where can I find the current variant loop in my theme?

Search for `getInStockVariants ` or `getStockVariants ` in your theme folder (typically in ` product.html`). That’s where you need to make the change. Remember to save a copy of the file first.

Does this affect Google Shopping or other feeds?

No. Displaying out-of-stock variants is only a change to the actual product page in your online store. Product feeds are handled separately and are based on the actual stock count per variant.

What happens to the statistics when I display out-of-stock variants?

The conversion rate may increase slightly because more customers sign up for stock notifications, but you also risk customers abandoning their carts because their desired size is out of stock. We recommend running an A/B test before rolling out the change to your entire store.

How can I quickly check if a variant is in stock in the admin panel?

Go to the product in the admin panel and look under “Variants.” Each variant has its own stock count, and you can filter the product list by stock status.

Can I display the total number of sold-out variants?

Yes. Count the rows where cnt is 0 in the loop. This can be used for a message such as “3 out of 6 sizes are out of stock.”

What’s the difference between `getInStockVariants` and `getStockVariants`?

getInStockVariants() always returns only the variants that are in stock. getStockVariants() can return either in-stock variants only (with `true` as the first parameter) or all variants (with `false`). Use the latter when you want to display sold-out options.

Should I delete old, out-of-stock variants entirely?

If a variant won’t be restocked, it’s cleaner to delete or hide it entirely from the product. Use the “show out-of-stock variants” feature for short-term sales and seasonal promotions, not for variants that have been permanently discontinued.

Need help? Contact us at support@shoporama.dk.