Categories: How ToMagento 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.

Click to rate this post!
[Total: 2 Average: 4]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate 🎖️ Certified Magento Developer👨‍💻. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.🏏

View Comments

  • 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

  • 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

    • 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');
      }

  • 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?

    • 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.

Recent Posts

What are Net Sales? How to Calculate Your Net Sales?

In the world of business, understanding financial metrics is crucial for making informed decisions and…

2 days ago

Magento 2 Extensions Digest April 2024 (New Release & Updates)

Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…

2 days ago

The ABCs of Geofencing: Definition, Features and Uses

In this era, businesses are always on the lookout for ways to engage with their…

3 days ago

How to Delete Product Variant in a Shopify Remix App using GraphQL Mutations?

Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…

4 days ago

6 Innovative Tools Revolutionizing E-Commerce Operations

E-commerce has transformed the way consumers shop for products and services and interact with businesses.…

6 days ago

How Upcoming Cookie Changes Will Affect Your E-commerce Website?

The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…

6 days ago