How can I redirect a main menu to a specific homepage section while keeping the original URL?

Chaychay341235
Tourist
27 0 1

Hello everyone, i need some help with my store. I want to redirect my main menu named 'About Us" to a specific section in my homepage but i want to remain the url to www.mydomain.com/page/aboutus instead of the id of specific shopify section. Can anyone help?  I want to redirect it in this section below.

 

Shopify name url: www.ravinginbox.com

 

screenbud-d3301842-b4c8-4614-a505-e4d89ab805f2.png

Reply 1 (1)

prakashVt
Shopify Partner
95 9 16

Add this code to your JS file and it will work.

document.querySelector("#HeaderMenu-about-us").addEventListener("click",(e)=>{
e.preventDefault();
     document.querySelector("#shopify-section-template--21767037190437__c79ece61-6edd-4d33-be74-12b06c1d5534").scrollIntoView({ behavior: 'smooth' });
})

  Please keep in mind that if you remove the "about us" section from your website and add it back again, the ID of the section will change. This means that you will need to update the "shopify-section-template--21767037190437__c79ece61-6edd-4d33-be74-12b06c1d5534" to the new ID. I have included the current ID for your reference.

prakashVt_0-1709789344808.png

 

- Did you find my response useful? Mark it as "Accepted solution"; so others can see it, or just like it.
- VTN Power Wishlist Looking for a Wishlist App for your store? Check this app with the free plan available.
- Feel free to Contact me