콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
12634 화면

How to disable "Add to Cart" button in odoo17

아바타
취소
베스트 답변

Hello there, 

There are two main ways to disable the "Add to Cart" button in Odoo 17:

1. Temporarily Disable from the Website:

  • Go to the product page you want to modify.
  • Click on the "Customize" button.
  • Under "HTML/CSS/JS Editor," find the line with t-if="product._is_add_to_cart_possible()".
  • Change this to t-if="False".
  • Click "Save."

This will temporarily disable the "Add to Cart" button on that specific product page.

2. Permanently Disable from the Backend:

  • Go to Settings -> Technical Settings -> Views.
  • Search for "Product".
  • Open the relevant view (e.g., "Product Template").
  • In the XML view editor, find the t-field="sale_ok" attribute on the product template.
  • Set this attribute to False.
  • Save the view.

This will permanently disable the "Add to Cart" button for all products that use that product template.

Additional Considerations:

  • Out of Stock: If you want to indicate that a product is out of stock but still allow customers to see it, you can set the "Available Stock" to 0. This will automatically disable the "Add to Cart" button.
  • Price-Based Disabling: You can use Odoo's pricelist system to control which customers can see the "Add to Cart" button. For example, you can create a pricelist with zero prices for certain customer groups.
  • Custom Modules: If you need more complex control over the "Add to Cart" button, you can create a custom module to override the default behavior.

Remember to clear your browser cache and reload the page after making any changes!

Hope this helps ^^

아바타
취소