cropped rubikvariantimageslogocropped rubikvariantimageslogo
  • Pricing
  • Help Center
    • FAQ
    • Documentation
    • Video Tutorials
    • Contact Us
    • Questions & Answers
  • Partners
  • Affiliate
  • Blog
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 (13)
  • Rubik Variant Images Guides (21)
  • Rubik Variant Images Theme Compatibility (11)
  • Shopify Dropshipping (1)
  • Shopify News (3)
  • Shopify Tips & Tutorials (52)
badge shopify app store dark

Trending Posts

  • List of All Shopify Theme Store IDs (Updated 2025)
    List of All Shopify Theme Store IDs (Updated 2025)
    September 16, 2025
  • How to Show Variants as Separate Products on Shopify Collection Pages stamp
    How to Show Variants as Separate Products on Shopify Collection Pages
    September 15, 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
  • How to Find Your Shopify Theme Store ID (Step by Step Guide)
    How to Find Your Shopify Theme Store ID (Step-by-Step Guide)
    September 16, 2025
  • 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
  • Overcoming Shopify’s 100 Variant & 250 Image Limit (2025 Guide) white
    Overcoming Shopify’s 100 Variant & 250 Image Limit (2025 Guide)
    September 18, 2025
  • How to Display Multiple Variant Images in Shopify (No Coding)
    How to Display Multiple Variant Images in Shopify (No Coding)
    September 19, 2025
  • Shopify Shrine Pro Theme Variant Image Guide
    How to Add Multiple Variant Images in Shopify Shrine Pro Theme
    September 13, 2025
  • Activate Variant Image Swatches in All New Shopify Free Themes Horizon Themes Without Code or App
    Activate Variant Image Swatches in All New Shopify Free Themes (Horizon Themes) – Without Code or App
    June 9, 2025
  • shopify multiple variant images and variant image swatch
    Shopify Multiple Variant Images & Variant Image Swatch Guide (2025)
    August 28, 2025

Related Posts

How to Display Multiple Variant Images in Shopify (No Coding)
Shopify Tips & Tutorials, Rubik Variant Images Guides

How to Display Multiple Variant Images in Shopify (No Coding)

September 19, 2025

Showing the right images for each product variant is important for boosting conversions and reducing returns. Instead of displaying all product images together, you can show only the images related to the selected variant without writing any code. This is where Rubik Variant Images & Swatch comes in. The app allows you to assign multiple […]

Overcoming Shopify’s 100 Variant & 250 Image Limit (2025 Guide) white
Shopify Tips & Tutorials

Overcoming Shopify’s 100 Variant & 250 Image Limit (2025 Guide)

September 18, 2025

Shopify is one of the most popular e-commerce platforms today, but one of the most common issues merchants face with highly customizable products is the 100 variant limit and the 250 image limit. For example, if you have two or more variant options (such as color + pattern + size) and many possible combinations, the […]

How to Add Variant Image Swatches in Shopify Horizon Theme (Product & Collection Pages)
Shopify Tips & Tutorials

How to Add Variant Image Swatches in Shopify Horizon Theme (Product & Collection Pages)

September 17, 2025

Horizon is Shopify’s newest free theme, released in 2025, part of the Horizon collection. Along with Atelier, Savor, Fabric (and others like Ritual, Vessel, Heritage, Tinker, Pitch, Dwell), these are all Horizon‐type themes. These themes include built-in version image swatches (for product pages and collection pages) without needing to install any app. In this post, […]

List of All Shopify Theme Store IDs (Updated 2025)
Shopify Tips & Tutorials

List of All Shopify Theme Store IDs (Updated 2025)

September 16, 2025

Every theme in the Shopify Theme Store has a unique identifier called the Theme Store ID. This ID is different from the theme ID that is specific to your own store. The Theme Store ID remains the same across all stores using the same theme. For example, if your theme is Dawn, its Theme Store […]

  • 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.