Skip to main content
added 185 characters in body
Source Link
Narendra Vyas
  • 1.3k
  • 12
  • 29

All that if you want is not to show the "Add to cart" button. You will be in need to remove the block responsible for adding that on details page.

Have a look at this file:

vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml 

The block adding "Add to cart" is:

name="product.info.addtocart" 

** Do not make change in vendor you need to override the same in your theme and remove that block.

If you do not want to remove it you can have a look at:

vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml 

Again do not change in vendor override this file and you can apply condition/change as per yours need.

But with this changes will only be applicable on product view page. In order to perform customization on list view, have a look at this file:

vendor/magento/module-catalog/view/frontend/templates/product/list.phtml 

If stock reaches "0" and if from backend you have set not to display out of stock products then ideally it should not display. You can try by reindexing:

php bin/magento i:rei 

All that if you want is not to show the "Add to cart" button. You will be in need to remove the block responsible for adding that on details page.

Have a look at this file:

vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml 

The block adding "Add to cart" is:

name="product.info.addtocart" 

** Do not make change in vendor you need to override the same in your theme and remove that block.

If you do not want to remove it you can have a look at:

vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml 

Again do not change in vendor override this file and you can apply condition/change as per yours need.

But with this changes will only be applicable on product view page. In order to perform customization on list view, have a look at this file:

vendor/magento/module-catalog/view/frontend/templates/product/list.phtml 

All that if you want is not to show the "Add to cart" button. You will be in need to remove the block responsible for adding that on details page.

Have a look at this file:

vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml 

The block adding "Add to cart" is:

name="product.info.addtocart" 

** Do not make change in vendor you need to override the same in your theme and remove that block.

If you do not want to remove it you can have a look at:

vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml 

Again do not change in vendor override this file and you can apply condition/change as per yours need.

But with this changes will only be applicable on product view page. In order to perform customization on list view, have a look at this file:

vendor/magento/module-catalog/view/frontend/templates/product/list.phtml 

If stock reaches "0" and if from backend you have set not to display out of stock products then ideally it should not display. You can try by reindexing:

php bin/magento i:rei 
Source Link
Narendra Vyas
  • 1.3k
  • 12
  • 29

All that if you want is not to show the "Add to cart" button. You will be in need to remove the block responsible for adding that on details page.

Have a look at this file:

vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml 

The block adding "Add to cart" is:

name="product.info.addtocart" 

** Do not make change in vendor you need to override the same in your theme and remove that block.

If you do not want to remove it you can have a look at:

vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml 

Again do not change in vendor override this file and you can apply condition/change as per yours need.

But with this changes will only be applicable on product view page. In order to perform customization on list view, have a look at this file:

vendor/magento/module-catalog/view/frontend/templates/product/list.phtml