Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Artificial Intelligence
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to Hide Product Variants in E-commerce and Sales

Subscribe

Get notified when there's activity on this post

This question has been flagged
salesproductecommercewebsite
2 Replies
1709 Views
Avatar
The Pet Depot, Christopher Chong

I have some products that do not have any stock in my inventory. Instead of having the unavailable product or product variant displayed online (without an add to cart button which confuses customers), I want to keep it hidden. How can I do that?

I also notice that depending on the arrangement of your variants -- which you have no control -- if the first variants is out of stock, the add to cart button on your shop disappears. What can I do to improve my website in hiding product variants if they have no stock. When I try unchecking the active box and keep the product published, I get server errors. And, if I unpublish a variant, the whole product -- along with its available variants -- are also unpublished. I don't want to delete the variants because they will be useful reference for future purchases. What can be done?

0
Avatar
Discard
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer
Hi,

To hide out-of-stock products or variants without deleting them, avoid unchecking Active or unpublishing variants, as this can cause errors or unpublish the entire product. Instead, enable the option in Website → Settings → Inventory to prevent selling out-of-stock items.

If you want products fully hidden when stock is zero, use an automated action or small customization to automatically unpublish products with no available quantity while keeping them active internally.

For variants, since Odoo loads the first variant by default (which may hide the Add to Cart button if out of stock), a minor customization is needed to either hide out-of-stock variants or prevent them from blocking the whole product page.

Related Module: https://apps.odoo.com/apps/modules/18.0/website_hide_variants

Solved Forum

1.  https://www.odoo.com/sl_SI/forum/pomoc-1/hide-out-of-stock-variants-on-ecommerce-179359

2. https://www.odoo.com/sl_SI/forum/pomoc-1/how-to-hidden-products-and-variants-in-website-shop-if-stock-product-is-0-218904




Hope it helps.

0
Avatar
Discard
Avatar
DTech (pvt) ltd, Abhishek Bandaranayaka
Best Answer

By default, Odoo eCommerce keeps products visible even if they are out of stock, which can indeed confuse customers.

There are two clean ways to handle this without deleting variants.

✅ 1. Automatically Hide Products When Out of Stock

Enable stock-based visibility:

  1. Go to Website → Configuration → Settings

  2. Under Shop, enable:

    • Inventory Availability

  3. Set Out-of-Stock behavior to:

    • “Show inventory below a threshold” or

    • Disable “Continue selling when out of stock”

Then on the product form:

  • Make sure Continue Selling is unchecked.

If a product has zero quantity and backorders are not allowed, Odoo will automatically remove the Add to Cart button and can prevent display depending on configuration.

✅ 2. Hide Out-of-Stock Variants (Recommended Approach)

The cleanest solution is to filter unavailable variants directly in the website template instead of archiving them.

Create a small custom module and inherit the product variant template to hide variants with zero stock.

Example override:

<template id="hide_out_of_stock_variants"

inherit_id="website_sale.product"

name="Hide Out of Stock Variants">


<xpath expr="//t[@t-foreach='combination_info.variant_values']"

position="attributes">

<attribute name="t-if">

combination_info.product_id.qty_available > 0

</attribute>

</xpath>


</template>

This ensures:

  • Variants with qty_available = 0 are not shown

  • The main product remains published

  • No server errors

  • Variants are preserved for future use

✅ 3. Fix “First Variant Out of Stock Removes Add to Cart”

This happens because Odoo selects the first variant by default.

To improve this behavior:

  • Reorder attribute values so an in-stock variant is first

    OR

  • Customize the JS logic to automatically select the first available variant instead of the first defined one.

The proper technical solution is to adjust the combination selection logic in website_sale so that it selects a variant where qty_available > 0.

❌ What Not to Do
  • Do not uncheck Active on variants (causes integrity issues).

  • Do not unpublish variants individually (unpublishes entire template).

  • Do not delete variants if you need them later.

✔ Best Practice

If you want full control and clean UX:

  • Keep products published

  • Disable “Continue Selling”

  • Hide unavailable variants via template override

This keeps your catalog clean while preserving historical data.

-2
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Ecommerce sales with regular grouped payment by bank transfer on invoices only
sales ecommerce website
Avatar
0
Feb 25
2312
odoo 16 website eCommerce product image upload validations error
product ecommerce website
Avatar
Avatar
1
Oct 23
4036
Display Internal Reference on E-Commerce
product ecommerce website
Avatar
Avatar
Avatar
Avatar
Avatar
4
Oct 23
7547
Obsolete product replaced with new compatible product V14
sales product ecommerce
Avatar
Avatar
1
Sep 22
2467
Age control
sales ecommerce age website
Avatar
Avatar
Avatar
2
Apr 26
841
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now