How to Create Custom URL for Checkout Page in Magento 2

How to Create Custom URL for Checkout Page in Magento 2

Sometimes you may require to change the default Magento URLs of some of the pages in order to handle and recognize them in a better way. The use of fancy URL leads you to initiate rewrite for them.

Here we have come up with a quick solution to change URL of checkout page. From this, you can change URLs of wishlist page and customers’ my account page as well.

Basic checkout page URL is something like:
domain.com/checkout
domain.com/checkout/#shipping
domain.com/checkout/#payment

    1. Create a new module with module.xml file
      
      
          
              
                  
              
          
      
      
    2. Go to etc/frontend/routes.xml and change the code as stated below.
      
      
          
              
                  
              
          
      
      

      Sometimes you may face issue with mini cart update or with AJAX cart extension as you have made changes in route file of Magento. This will require you to fix up the section reloading while using AJAX.

  1. Go and find sections.xml” located at etc/frontend, it must be something like this,
        
    
    
  2. You will need to override all the actions resided at Magento/Catalog/etc/frontend/sections.xml and you’re done.

Hope you have found this effective rewrite trick useful and it will definitely help you creating fancy URLs in Magento.
Feel free to contact if you have any queries regarding. We would appreciate your comments and suggestions.

Previous Article

Magento releases CE 1.9.2.3, 2.0.1 and 2 security patches

Next Article

How to Redirect Category with Single Product to Product Page in Magento 2

Write a Comment
  1. Hi,
    I create a order programmability but my mini-cart cache not showing item in this and when i click on this showing cart is empty.
    So how can i refresh mini-cart cache?

    1. Hi Prince Yadav,
      Generally in Magento 1, mini cart can be updated using following code. You can try implementing it in your script.
      $miniCart = $this->getLayout()
      ->createBlock('checkout/cart_sidebar')
      ->addItemRender('simple', 'checkout/cart_item_renderer', 'checkout/cart/sidebar/default.phtml')
      ->addItemRender('configurable', 'checkout/cart_item_renderer_configurable', 'checkout/cart/sidebar/default.phtml')
      ->setTemplate('checkout/cart/cartheader.phtml')
      ->toHtml();

      And if you are using AJAX mini cart, use following code:
      if (typeof extendFunctions !== "undefined" && typeof extendFunctions.showMiniCart !== "undefined") {
      extendFunctions.showMiniCart.each(function(item_function, index) {
      if(jQuery.isFunction(item_function)) {
      item_function(data);
      }
      })
      }

      Drop us again if you need more help.

  2. Hello How to update mini cart in magento 2 actually we created quick view when tou added product to cart then
    mini cart is not updated after page refresh it shows can you tell how do it in jquery or code

    1. Try placing this code in ajax success method,
      if (typeof extendFunctions !== "undefined" && typeof extendFunctions.showMiniCart !== "undefined") {
      extendFunctions.showMiniCart.each(function(item_function, index) {
      if(jQuery.isFunction(item_function)) {
      item_function(data);
      }
      })
      }
      if(mobilecheck()) {
      jQuery('html, body').animate({ scrollTop: 0 }, 'slow');
      }

  3. Would it be possible to update snippets, since they appear to be empty ?

    I need to make

    domain.com/checkout/#shipping -> domain.com/checkout/step/shipping or something in that direction

Leave a Comment

Your email address will not be published. Required fields are marked *

Get Connect With Us

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨