Return management just got easier! We’ve launched Customer Self-Serve Returns to all Shopify merchants. Click here to learn more!

Changing default landing page to product page sense theme

Solved
samm7560
Tourist
3 0 1

Hi everyone,

 

On my product page I have full details and an app integrated onto it with trust badges which I cannot display on my home page. I would like to change the default "home" page to my product page. I previously tried this line of code however it redirected to collection page and I cannot find the correct solution: 

{%- if template contains 'index' -%}
<script>
window.location.href = '/products';
</script>
{%- endif -%}

 

Id then just like to completely remove the home page in its entirety as I will have no need for it as product page will be the new homepage.

 

Thanks!

Accepted Solution (1)

Accepted Solutions
amanbatra
Shopify Partner
89 13 12

This is an accepted solution.

Hello @samm7560 

 

You are using the code you just set it to the products you need to pass the handle of the product too which you can get from the product page url

{%- if template contains 'index' -%}
<script>
window.location.href = '/products/handle-of-product';
</script>
{%- endif -%}

Is the solution works for you ? please Like and Accept Solution.
Need more help with theme customization and store development ?
WA: +917508271396, Email: amanbatra.developer@gmail.com, Skype: amanbatra.developer

View solution in original post

Replies 2 (2)
amanbatra
Shopify Partner
89 13 12

This is an accepted solution.

Hello @samm7560 

 

You are using the code you just set it to the products you need to pass the handle of the product too which you can get from the product page url

{%- if template contains 'index' -%}
<script>
window.location.href = '/products/handle-of-product';
</script>
{%- endif -%}

Is the solution works for you ? please Like and Accept Solution.
Need more help with theme customization and store development ?
WA: +917508271396, Email: amanbatra.developer@gmail.com, Skype: amanbatra.developer
samm7560
Tourist
3 0 1

Thank you very much! I did try this last night and got a 404 page instead but this has now worked!