How to change the label of add to cart to pre order on all magento 2.4.5 based on the below conditions:

if(qty<0 , product is salable and getBackorders()/true )

to show pre order else add to cart.

Please suggest a way to implement this.

1 Answer 1

  1. First create catalog_category_view.xml into your custom extension at following path.


<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="category.products.list">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Extension::catalog/product/list.phtml</argument>
  1. Now copy the magento default category list file from :




  1. now into your extension file, you need to put conditions before Add To Cart Button according to your requirements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.