2

I see below configuration in Magento 2 layout at vendor\magento\module-checkout\view\frontend\layout\checkout_cart_index.xml. I created custom module and copied existing Link Block and link.phtml to the custom module folders.

<block class="Magento\Checkout\Block\Cart" name="checkout.cart.methods.bottom" template="Magento_Checkout::cart/methods.phtml">
    <container name="checkout.cart.methods" as="methods" label="Payment Methods After Checkout Button">
        <block class="Magento\Checkout\Block\Onepage\Link" name="checkout.cart.methods.onepage.bottom" template="Magento_Checkout::onepage/link.phtml" />
        <block class="Magento\Checkout\Block\QuoteShortcutButtons" name="checkout.cart.shortcut.buttons" />
    </container>
</block>

I tried to override by adding one of the entry in app/code/Vendor/Checkout/view/frontend/layout/checkout_cart_index.xml but getting error 500 with first approach.

<referenceContainer name="checkout.cart.methods">
    <block class="Vendor\Checkout\Block\Onepage\CustomLink" name="custom.checkout.cart.methods.onepage.bottom" template="Vendor_Checkout::onepage/customlink.phtml">
    </block>
</referenceContainer>

I do see custom Block and phtml files in Commerce Bug tool but not seeing any code getting displayed from these files. Please shed some light since none of the approaches listed at also didn't help.

<referenceContainer name="checkout.cart.methods.onepage.bottom">
    <block class="Vendor\Checkout\Block\Onepage\CustomLink" name="custom.checkout.cart.methods.onepage.bottom" template="Vendor_Checkout::onepage/customlink.phtml">
    </block>
</referenceContainer>
  • Did you checked system.log and exception log? – Kamlesh Solanki Apr 4 at 6:41
  • Yes, no errors in system.log and exception.log files related to the cart page. – cnu Apr 4 at 11:50
  • The error 500 was caused due to typo in variable in the custom Block that extended OOB Link Block. My code should add additional text/data around 'proceed to checkout' button based on customer group data but it's displaying same data for every customer even when a given customer is not in that group. I tried cacheable=false in the layout and it didn't fix anything. – cnu Apr 4 at 16:57
  • @cnu I have been facing same issue unable to override could you please guide and advise me which is the best approach – Nagaraju K Nov 14 at 18:40
0

It's working with below changes to checkout_cart_index.xml and fixing issues with custom Block session code.

<referenceContainer name="checkout.cart.methods">
        <block class="Vendor\Checkout\Block\Onepage\MyLink" name="checkout.cart.methods.onepage.bottom" template="Vendor_Checkout::onepage/mylink.phtml">
        </block>
    </referenceContainer>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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