I want to display "clear shopping cart" and "continue shopping" buttons on my checkout page. But i dont see configurations for the same. i checked the /srv/public_html/vendor/magento/module-checkout/view/frontend/templates/cart/form.phtml and in this buttons are der . But i dont know how to configure them. plz help

enter image description here

enter image description here

2 Answers 2


Their is 3 case

1 -> Go to view/frontend/templates/cart/form.phtml under which theme you used. Then Check on that before clear shopping cart button

  if ($block->getViewModel()->isClearShoppingCartEnabled()) 

remove this condition . It Shows.

2-> If You used default luma theme Then Please remove above condition on form.phtml

3-> .cart-container .form-cart .actions.main .continue { display: none; } you can overwrite this by display:block ,

for Continue Shopping

.cart-container .form-cart .actions.main .continue {display: block !important;}

For Clear Shopping Cart

.cart-container .form-cart .actions.main #empty_cart_button {display: block !imortant;


  • I think that the condition should stay in place and give a more flexibility to decide whether you want to display the continue URL or not, by customizing the functionality and add an admin configuration. Also, your PHP code line is from Magento 2.4.
    – Diana
    Feb 1, 2021 at 13:36
  • Yes You are right . but if any problem to filter this (after enable clear shopping cart on admin configuration ) that is the solution to remove it .
    – smruti
    Feb 1, 2021 at 13:40

First of all, these options are available in the cart page, so basically that's where you will find them (not the checkout page). Secondly, they are styled as links by default.

For the 'continue shopping' one I think you need to write some code to enable this functionality. If you check the method getContinueShoppingUrl() mentioned at line 52 of your printscreen, you will see the following:

enter image description here

The solution that I see, is to set the 'continue_shopping_url' property on the cart object by custom code (controlled by a custom admin configuration show/hide), probably via an observer, after adding products to cart. You will have to decide which is the URL to add (it can be anything from the homepage URL as in old versions of Magento, to the referrer URL or a custom setting).

However, if you don't intend to use the referrer and your continue shopping URL is a fixed one, I would probably go with a more permanent solution and change the behavior of this method via a plugin (but keeping the same idea that you can control by admin config whether you want to show it or not).

The checkout session property seen in my printscreen is used in vendor/magento/module-checkout/Controller/Cart.php getBackUrl() method called by the vendor/magento/module-checkout/Controller/Cart/Add.phpaction, where it handles the case where you should remain on the page you added the product to cart from (as per Magento configuration) so it has implicity the value of the referrer URL.

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.