cropped rubikvariantimageslogocropped rubikvariantimageslogo
  • Pricing
  • Help Center
    • FAQ
    • Documentation
    • Video Tutorials
    • Contact Us
    • Questions & Answers
  • Partners
  • Affiliate
  • Blog
    • Shopify Tips & Tutorials
    • Rubik Variant Images Guides
    • Integrations & Partnerships
    • Shopify News
badge shopify app store light
Shopify Tips & Tutorials

How to Hide Unavailable Variants on Shopify: A Complete Guide (2025 Tutorial)

April 22, 2025
how to hide unavailable variants on shopfiy

Displaying sold-out or unavailable product variants can lead to customer frustration and lost sales. Fortunately, Shopify offers several methods to manage this issue effectively. In this guide, we’ll explore various strategies to hide or disable unavailable variants on your Shopify store.​

1. Modify Theme Code to Hide Sold-Out Variants

For stores using Shopify’s vintage themes, you can customize your theme code to hide sold-out variants:

  • From your Shopify admin, go to Online Store > Themes.
  • Find the theme you want to edit, click Actions, and select Edit code.
  • In the Assets directory, locate and click on theme.js or theme.js.liquid or global.js.
  • At the bottom of the file, paste the following code:​
document.addEventListener('DOMContentLoaded', function() {
  const productJson = document.querySelectorAll('[id^=ProductJson-');

  if (productJson.length > 0) {
    for (let i = 0; i < productJson.length; i++) {
      const current = productJson[i];
      const sectionId = current.id.replace('ProductJson-', '');
      const section = document.querySelector('[data-section-id="' + sectionId + '"]');
      const product = JSON.parse(current.text);

      if (product.options.length === 1) {
        const unavailableVariants = [];

        for (let j = 0; j < product.variants.length; j++) {
          const variant = product.variants[j];

          if (!variant.available) {
            unavailableVariants.push(variant);
          }
        }

        if (unavailableVariants.length > 0) {
          const mutationCallback = function() {
            const variantOptions = section.querySelectorAll('.single-option-selector option');

            if (variantOptions.length > 0) {
              for (let k = 0; k < unavailableVariants.length; k++) {
                const unavailableVariant = unavailableVariants[k];

                for (let l = 0; l < variantOptions.length; l++) {
                  const option = variantOptions[l];

                  if (unavailableVariant.title === option.value) {
                    option.remove();
                  }
                }
              }
            }
          };

          const observer = new MutationObserver(mutationCallback);
          const config = { childList: true, subtree: true };
          const addToCartForm = section.querySelector('form[action="/cart/add"]');

          if (addToCartForm) {
            observer.observe(addToCartForm, config);
          }
        }
      }
    }
  }
});
  • Click Save to apply the changes.​

2. Use Shopify Apps to Manage Variant Visibility

If you’re not comfortable editing code, several Shopify apps can help manage variant visibility:​

  • Camouflage – Hide Sold Variants: This app allows you to hide, disable, or strike-through sold-out variants. It offers customization options and works with the latest themes. ​
  • Nada: Sort & Hide Out-of-Stock: Automatically hides sold-out products by unpublishing them from the online store sales channel and republishes them when back in stock.

Managing the visibility of unavailable variants enhances the shopping experience and can lead to increased sales. Whether you choose to edit your theme code, use an app, adjust inventory settings, or automate with Shopify Flow, each method offers a way to keep your product pages clean and customer-friendly.​

Keywords:

  • Hide unavailable variants Shopify
  • Hide sold-out variants Shopify
  • Shopify hide out-of-stock variants
  • Shopify variant visibility
  • Shopify hide sold-out options​
  • Shopify hide product variants
  • Shopify hide unavailable options
  • Shopify hide variants in dropdown
  • Shopify hide sold-out combinations
  • Shopify hide variants when out of stock​
  • How to hide sold-out variants in Shopify
  • Shopify hide unavailable product options
  • Shopify hide out-of-stock variants in dropdown
  • Shopify hide sold-out variants in product page
  • Shopify hide unavailable variant combinations
  • Shopify hide sold-out variants app
  • Shopify hide sold-out variants code
  • Shopify hide sold-out variants theme
  • Shopify hide sold-out variants script
  • Shopify hide sold-out variants liquid​
Umid Aydemir

Co-Founder of Rubik Variant Images & Swatch

Post navigation

Previous
Next

Search

Categories

  • Affiliate Program (1)
  • Integrations & Partnerships (12)
  • Rubik Variant Images Guides (20)
  • Rubik Variant Images Theme Compatibility (11)
  • Shopify Dropshipping (1)
  • Shopify News (3)
  • Shopify Tips & Tutorials (46)
badge shopify app store dark

Trending Posts

  • How to Group Products into One Combined Listing with Variants on Shopify
    How to Group Products into One Combined Listing with Variants on Shopify
    September 13, 2025
  • How to Display Featured Image on Collection Pages but Hide Them on Product Pages
    How to Show a Featured Image on Collection Pages and Hide It on Product Pages
    September 12, 2025
  • Shopify Shrine Pro Theme Variant Image Guide
    How to Add Multiple Variant Images in Shopify Shrine Pro Theme
    September 13, 2025
  • How to Show Only Relevant Variant Images with Instant Page Builder
    How to Show Multiple Relevant Variant Images with Instant Page Builder
    September 8, 2025
  • How to Hide Out of Stock or Unavailable Variants in Shopify Step by Step Guide
    How to Hide Out-of-Stock or Unavailable Variants in Shopify (Step-by-Step Guide)
    September 5, 2025
  • How Do I Replace Variant Dropdowns with Clickable Swatches in Shopify
    How Do I Replace Variant Dropdowns with Clickable Swatches in Shopify?
    September 5, 2025
  • shopify multiple variant images and variant image swatch
    Shopify Multiple Variant Images & Variant Image Swatch Guide (2025)
    August 28, 2025
  • how to find theme store id shopify
    How to Find Your Theme’s Shopify Theme Store ID (2025 Guide)
    April 21, 2025
  • How to Display Multiple Variant Images in Shopify with GemPages
    How to Display Multiple Variant Images in Shopify with GemPages
    September 10, 2025
  • Top 5 Variant Image Color Swatch Apps for Shopify 2025
    Top 5 Variant Image & Color Swatch Apps for Shopify (2025)
    September 11, 2025

Related Posts

How to Group Products into One Combined Listing with Variants on Shopify
Integrations & Partnerships, Shopify Tips & Tutorials

How to Group Products into One Combined Listing with Variants on Shopify

September 13, 2025

Managing multiple similar products separately can be confusing for both you and your customers. In this guide, you’ll learn how to group products into one combined listing with variants on Shopify, making your store easier to manage and improving the shopping experience. On Shopify, you can normally create products with variants directly. For example, if […]

Shopify Shrine Pro Theme Variant Image Guide
Shopify Tips & Tutorials, Rubik Variant Images Theme Compatibility

How to Add Multiple Variant Images in Shopify Shrine Pro Theme

September 13, 2025

Although Shrine Pro is not officially listed on the Shopify Theme Store, it has become one of the most popular themes among Shopify merchants. One of the most common issues with this theme is the inability to display relevant variant images properly. For example, if your product has 5 color variants and each variant contains […]

How to Display Featured Image on Collection Pages but Hide Them on Product Pages
Shopify Tips & Tutorials

How to Show a Featured Image on Collection Pages and Hide It on Product Pages

September 12, 2025

By default in Shopify, the first product media you upload becomes the featured image on collection pages and the homepage. The second image is usually shown on hover. In some cases, you may want to change the featured image but avoid displaying it on the product page itself. Since Shopify does not allow you to […]

Top 5 Variant Image Color Swatch Apps for Shopify 2025
Shopify Tips & Tutorials

Top 5 Variant Image & Color Swatch Apps for Shopify (2025)

September 11, 2025

Are you tired of the boring text variant selectors on your Shopify product pages? Do you want to turn them into stylish color swatches, or even take it further and convert your color swatches into image swatches? Either way, upgrading your variant picker can significantly increase your conversion rate. It does not matter which theme […]

  • Documentation
  • Partners
  • Privacy Policy
  • Affiliate
cratshift logo beyaz

We are a Shopify Partner offering high-quality app solutions crafted for Shopify.

Our Apps
  • Smart Bulk Image Upload
  • Export Product Images
  • Bulk Delete Products
  • Rubik Variant Images
Quick Links
  • Pricing
  • Contact Us
  • FAQ
  • Blog
Blog Categories
  • Shopify Tips & Tutorials
  • Rubik Variant Images Guides
  • Integrations & Partnerships
  • Shopify News
cropped rubikvariantimageslogo

© 2025 Rubik Variant Images by Craftshift®

All rights reserved.