Is there a way to hide, grey-out or strikethrough variants that are not in stock on the product page? So customers don't have to click through all variants to see which are available, which can be annoying for them.
I know there is a third-party app that does this, but since i'm in v15 online, I can't use it.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
Yes, it is possible to hide, grey-out, or strikethrough variants that are not in stock on the product page in Odoo 15. This can be done by creating a custom module that modifies the product template and product variants views, and adding conditions based on the stock availability of the variants.
One way to accomplish this is to use the attrs attribute on the variant field in the product template view. This attribute allows you to define a JavaScript expression that will be evaluated for each variant, and can be used to set the CSS class or style of the variant based on its stock availability.
For example, you could use the attrs attribute to add a class to the variant field that will hide the variant if its stock is zero, and grey-out the variant if its stock is low.
Then in your css file you can add the css class to make it look grayed out.
.oe_product_variant_low_stock:before{ content: 'Out of Stock'; color: red; }
In a similar way you can use the same logic to make the variants look strikethrough by using the following css class
.oe_product_variant_low_stock{ text-decoration: line-through; }
It's important to note that this is a basic example and you should adjust it according to your specific requirements. Also, it is always recommended to test your code in a development environment before deploying it to production.
Hi,
To hide unavailable variants from the product page in Odoo, you can use the Website Hide Variants module from the Odoo App Store.This module helps to hide variant which are unavailable by clicking on a boolean field
Here is the link to the app:
https://apps.odoo.com/apps/modules/16.0/website_hide_variants/
Regards
Thanks for the answer.
But I am in v15 online, so I can not add custom modules, or am I missing something?
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Aug 22
|
1225 |
Any hint to a tutorial/explanation on how to create a custom module in Odoo online?
I can not find any useful information in the internet on how to create custom modules to modify the product template?