Liquid Theme
Get Reactify Search installed onto your Shopify theme.
1. Prepare your theme
First, you will need to add support to your theme code for a build step that uses the React packages we provide. Most custom themes will already have this in place and generally use webpack or esbuild to compile the TypeScript files into a bundle suitable for use in the theme.
Once you have this structure in place, you are ready to start the implementation.
2. Add script and data tags
The script tags provide liquid-rendered data in JSON format, which can be used within child components.
<html>
<head>
<script src="{{ 'reactify.js' | asset_url }}" defer></script>
</head>
<body>
{%- render "reactify" -%}
...
</body>{%- if template.name contains 'search' -%}
<script id="reactify-data" type="application/json">{{ page | json }}</script>
{%- endif -%}
{%- if template.name contains 'collection' -%}
<script id="reactify-data" type="application/json">{{ collection | json }}</script>
{%- endif -%}3. Add mount points
The mount points are used to load in the React application to specific areas like instant search within the header and the collection and search templates.
Instant Search
<div id="reactify-mount-instant-search"></div>Collection
Search
4. Implement scripts for the different areas
See ReactifySearchLiquidFactory for details on how the factory configures the provider.
Last updated
Was this helpful?