Step 1: Back up your theme!
First, you’ll want to take a backup copy of your theme. Just in case.
Step 2: Find the code to remove
For this example, I’m using an old version of Turbo (6.2) by Out of the Sandbox.
In the Shopify admin, go to Online Store → Themes → select the … → Edit Code. Search your theme files for within: collection.
This part can be a bit tricky to locate because Shopify doesn’t have a theme-wide search. So you have to go file by file. For this version of Turbo, the code I need to edit is in the snippets/product-details.liquid file and the snippets/product-thumbnail.liquid file.
Since each theme is different you may need to find the file for the product-grid or product-loop. If you still aren’t sure where this code is, you can search through each snippet file. There are Chrome extensions to search through your Shopify theme files, but I avoid using Chrome which is a story for another day.
Once you’ve found the within: collection we want to remove only that part.
We’ll end up with something like this:
Before:
{{ product.url | within: collection }}
After:
{{ product.url }}
You may need to search a few times for that line of code to make sure the | within: collection is removed for multiple spots. Many themes have the same piece of code duplicated.
Save the files you’ve edited and check on your results.
Step 3: Test the pages
Anytime you edit the theme files, you’ll want to check right away to make sure you didn’t break anything.
Shopify caches pages LIKE CRAZY so it may take a few minutes for your changes to reflect on the live site.
To test your changes, select a collection and navigate to a random product. In your URL bar, it should not have the collection or collection name.
Step 4: Create redirects
Assuming your site is live and you’ve already had your collection base product URLs indexed, don’t forget to create URL redirects. Forgetting to do this important piece will cause potential customers to land on an error page.