How to redirect a page

How to redirect a page

charlness
Visitor
2 0 2

Hi all,

 

I want to know how can I redirect my collections button to a particular page? I want my fourth collection to my "service/ collaboration" page (https://studiocharlness.com/pages/service-and-collaboration), as I am a freelance artist and my service do not have a fixed price, how can I edit the button so that people could still get a quote from my art service while able to shop my art product.

Screenshot 2024-12-26 at 2.10.11 PM.png

Replies 8 (8)

Rohail_Ali_12
Shopify Partner
93 12 14

Hi @charlness,

Based on your screenshot, it looks like you are using the collection list section, which only displays links to the collections you’ve created in your store. However, if you want to add a page link, you may use the image-with-text section, or you will need to create a new section through coding to support links for both pages and collections.

Best regards,

If helpful then please Like and Accept Solution.
Feel free to contact me for your Website Tasks: info@rsdigitals.com
Explore Premium Themes with Editable Creatives: https://www.rsdigitals.com/

Rony_ShopiDevs
Shopify Partner
16 2 2

Hi,

 

These are two way to do that, One is you can add setting to put external link on fourth collection and another is you can do that with custom js.

You can paste below js code to your theme js file end line

 

const redirectElements = document.querySelectorAll('.collection-list .full-unstyled-link');

redirectElements.forEach(element => {
  element.addEventListener('click', () => {
    window.location.href = 'https://studiocharlness.com/pages/service-and-collaboration';
  });
});

Thanks

 

Found it helpful? Please like and mark the solution that helped you.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers
charlness
Visitor
2 0 2

I'm sorry, but do you know how to edit the code in the collection button? I'm kinda lost so I'm not sure what to do now...

Rony_ShopiDevs
Shopify Partner
16 2 2

I need to investigate your theme code, then I can tell you where need to edit in the collection button.

Found it helpful? Please like and mark the solution that helped you.
Slider Revolution - Create sliders, theme sections, banners, videos, pages, advanced animation, and social feeds.
Essential Grid Gallery - Create photo galleries, video galleries, portfolio galleries, product gallery, collection gallery and more.
EasyDisplay: Product Showcase - Easily display collections, related products, discounts, recently viewed items, and best sellers

websensepro
Shopify Partner
1771 202 242

Hi @charlness 

 

  • Access the Theme Editor:

    • Go to your Shopify Admin > Online Store > Themes.
    • Click Actions > Edit Code on the theme you are using.
  • Locate the Theme's JavaScript File:

    • In the Assets folder, look for a file like theme.js or custom.js.
    • Copy the JavaScript code provided above.

 

websensepro_0-1735197401842.pngwebsensepro_1-1735197508279.png

 

 

 

document.addEventListener('DOMContentLoaded', function () {
  const collectionButton = document.querySelector('.full-unstyled-link');
  if (collectionButton) {
    collectionButton.setAttribute('href', 'https://studiocharlness.com/pages/service-and-collaboration');
    collectionButton.setAttribute('role', 'link');
    collectionButton.setAttribute('aria-disabled', 'false');
    collectionButton.classList.remove('aria-disabled');
  }
});

 

 

If my reply is helpful, kindly click like and mark it as an accepted solution.

If you are happy with my help, you can help me buy a COFFEE

Thanks!

Need a Shopify developer? Hire us at WebSensePro For Shopify Design Changes/Coding
For Free Tutorials Subscribe to our youtube
Get More Sales Using Big Bulk Discount APP
Create Your Shopify Store For Just 1$/Month
Get More Sales Using Big Bulk Discount APP

Wilkerson43
Visitor
2 0 0

I am also having the same Issue. Did you get any solution?

Bundler-Manuel
Trailblazer
536 25 61

Hey there @charlness  find your way to the Edit Code section of your store then head to Asset->/theme.liquid then Paste below code before </body> in theme.liquid file

<script>
let url = window.location.href;
if (url.includes('/collections/classics')) {
location.href = '/pages/classics';
}
if (url.includes('/collections/collection-2')) {
location.href = '/pages/collection-2';
}
</script>
This should settle everything

Emmanuel
Please let me know if it works by marking it as a solution!
Bundler - Product Bundles app, a great bundle app for Shopify, with glowing user testimonials and a free plan.

Wilkerson43
Visitor
2 0 0

I am also having the same Issue. Did you get any solution?

Brevard County Property Appraisers