Template tests on Shopify
Test Shopify alternate templates with a same-page redirect and the view query parameter.
Shopify can render an alternate template when a storefront URL includes a
view query parameter. Apex supports this as a redirect test on the same page.
For example, the source page can be:
https://shop.example/products/exampleThe treatment destination can be:
https://shop.example/products/example?view=alternatePrepare the Shopify template
- Create the alternate template in the Shopify theme.
- Assign the template a suffix, such as
alternate. - Open the clean product URL with
?view=alternateand confirm the template renders. - Confirm the Apex snippet runs on both versions of the page.
Create the test in Apex
Select Redirect test in the new-test form. Use the clean page URL as the
page or store URL. Use the same URL with ?view=<suffix> as the treatment
destination.
Apex redirects treatment visitors once. A visitor already on the treatment URL is not redirected again. Control visitors stay on the clean URL.
Create the test with the CLI
apex experiments create \
--name "Product template test" \
--type redirect \
--source-url "https://shop.example/products/example" \
--destination "https://shop.example/products/example?view=alternate"The shop must have redirect tests enabled. Configure the goal and complete the quality assurance checks in the dashboard before launch.
Preview and QA
Open the treatment URL directly to check the alternate template. Then use the Apex quality assurance workspace to preview both variations on desktop and mobile. Confirm that the primary goal records on both page versions.
Direct entry is different from assignment. A control-assigned or unassigned
visitor who opens the ?view= URL directly sees the alternate template. Apex
does not redirect that visitor back to the clean URL.
Search indexing and links
Shopify emits a canonical URL for the clean page. This helps search engines
identify the main page. Do not link the ?view= URL in public navigation,
campaigns, or other indexed content. Keep it as the test destination.