We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    Please find below steps to override default.phtml by using plugin

    1. Create an di.xml in : /app/code/Vendor/ModuleName/etc

    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">    
        <!-- override cart/item/default.phtml file -->
        <type name="MagentoCheckoutBlockCartAbstractCart">
            <plugin name="change_template_for_default" type="VendorModuleNamePluginCartAbstractCart" sortOrder="1"/>
        </type>    
    </config>

    2. Create an AbstractCart.php in : app/code/Vendor/ModuleName/Plugin/Cart

    <?php
    namespace VendorModuleNamePluginCart;
    class AbstractCart
    {
        /*
        *   Override cart/item/default.phtml file
        *   MagentoCheckoutBlockCartAbstractCart $subject
        *   $result
        */
        public function afterGetItemRenderer(MagentoCheckoutBlockCartAbstractCart $subject, $result)
        {
            $result->setTemplate('Vendor_ModuleName::cart/item/default.phtml');
            return $result;
        }
    } ?>

    You can change below file as per requirement your custom module base

    3. Create an default.phtml in : /app/code/Vendor/ModuleName/view/frontend/templates/cart/item

    field_5bfb909c5ccae

      Get a Free Quote