Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Artificial Intelligence
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Property Management
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    • Referral Program
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to Hide Product Variants in E-commerce and Sales

Subscriure's

Get notified when there's activity on this post

This question has been flagged
salesproductecommercewebsite
2 Respostes
1851 Vistes
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
Descartar
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
Descartar
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
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
Ecommerce sales with regular grouped payment by bank transfer on invoices only
sales ecommerce website
Avatar
0
de febr. 25
2402
odoo 16 website eCommerce product image upload validations error
product ecommerce website
Avatar
Avatar
1
d’oct. 23
4151
Display Internal Reference on E-Commerce
product ecommerce website
Avatar
Avatar
Avatar
Avatar
Avatar
4
d’oct. 23
7691
Obsolete product replaced with new compatible product V14
sales product ecommerce
Avatar
Avatar
1
de set. 22
2481
Age control
sales ecommerce age website
Avatar
Avatar
Avatar
2
d’abr. 26
914
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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