Shopify Manual Installation
Alternative installation method for Shopify stores that gives you complete control over button placement and styling. This method involves editing your theme's Liquid files directly.
Best for: Advanced Shopify users, older themes, custom styling needs Time required: 15-20 minutes Skill level: Basic HTML/Liquid knowledge required Alternative: Shopify App Installation (easier, recommended)
When to Use Manual Setup
β Your theme doesn't support app blocks (pre-Online Store 2.0)
β You need complete control over button styling
β You want custom button placement not possible with app blocks
β You're comfortable editing Liquid templates
β You manage multiple Shopify stores and prefer consistency
π‘ For most users, we recommend Shopify App Installation instead.
Before You Begin
Prerequisites
β Shopify Admin Access: Ability to edit theme code
β TrialClouds Account: Sign up at https://app.trialclouds.com
β Site ID: Complete onboarding to get your Site ID
β Theme Backup: Duplicate your theme before making changes
Backup Your Theme
Installation Overview
Manual installation involves two steps:
Add embed script to your theme (loads widget globally)
Add button code to product template (triggers widget on products)
Step-by-step Manual Installation
Step 1: Add the Embed Script
The embed script must be added to every page where you want try-on functionality.
Get Your Site ID
Login to https://app.trialclouds.com
Navigate to Sites section
Find your Shopify site (or create one with domain
yourstore.myshopify.com)Copy your Site ID (looks like
cmkozmnbi00012euxrl81rx69)
Access Theme Code Editor
In Shopify Admin, go to Online Store β Themes
On your live theme, click Actions (β―) β Edit code
The code editor opens showing your theme files
[Screenshot Placeholder: Shopify theme code editor with file tree on left]
Locate theme.liquid
In the left sidebar (file tree), find Layout folder
Click to expand it
Click on theme.liquid to open it
What is theme.liquid? It's the master template that wraps every page on your store. Adding the script here loads it globally.
Find the Closing Tag
With theme.liquid open, scroll to the bottom of the file
Look for the closing
</body>tag (usually near the end)You'll place the script just before this tag
Tip: Use Ctrl+F (or Cmd+F) to search for </body> to find it quickly.
Paste the Embed Script
Add this code just before the </body> tag:
Replace YOUR_SITE_ID with your actual Site ID from the Get Your Site ID step.
Example:
Save theme.liquid
Click the green "Save" button (top right)
Wait for "Saved" confirmation
The widget script is now loaded on all pages.
β Step 1 Complete! The widget infrastructure is ready.
Step 2: Add Try-On Button to Products
Now add the Try-On button to your product pages with dynamic data.
Locate Product Template
Your product template file depends on your theme structure. Common locations:
Sections:
sections/main-product.liquid(modern themes)Sections:
sections/product-template.liquidTemplates:
templates/product.liquid(older themes)
How to find it:
In the code editor, expand the Sections folder first
Look for files with "product" in the name (e.g.,
main-product.liquid,product-template.liquid,featured-product.liquid)If not in Sections, check Templates folder
Tip: If unsure, view your live product page source (right-click β View Page Source) and search for unique text like your product title or "Add to Cart". Then search your theme files for that text.
Choose Button Placement
Open your product template file and decide where to place the button.
Recommended locations:
After Product Images (most visible): look for
{{ product.featured_image }}or image gallery code β add button after this sectionBefore "Add to Cart" Button: find
<button type="submit"or "Add to Cart" button code β add button code just beforeAfter Product Information: look for product description
{{ product.description }}β add button after this
Tip: Search (Ctrl+F) for "add to cart" or "product-form" to find the right location.
Add Button Code
Paste this complete code at your chosen location:
What this does:
Uses Liquid variables to auto-populate product data
Works for all products automatically
Includes inline styling (customize as needed)
Handles sale prices conditionally
Understanding the Code (key parts)
Required class:
Must not be removed β widget won't work without it.
Product data (dynamic):
Liquid variables auto-fill product info; | escape prevents XSS; | json creates a proper JSON array for images.
Conditional sale price:
Only adds sale price attribute if product is on sale; removes currency symbols and commas.
Inline styling: The inline
styleprovides immediate styling; you can move styles to CSS (see Step 3).
Save Product Template
Click "Save" button (top right)
Wait for confirmation
β Step 2 Complete! Your manual installation is done.
Step 3: Customize Button Styling (Optional)
The inline styles work immediately, but for cleaner code, move styles to your theme's CSS.
Remove Inline Styles
Edit your button code to remove the style, onmouseover, and onmouseout attributes:
Add CSS to Theme
In code editor, go to Assets folder
Find your main CSS file:
theme.css,theme.scss.liquid, or your custom CSS fileOpen it and scroll to the bottom
Add this CSS:
Save the CSS file
Customize Colors to Match Brand
Edit the CSS to match your store's branding:
Ideas:
Match your "Add to Cart" button
Use brand's primary color
Use a complementary accent color
Step 4: Optional β Add Customer Data Capture
If you want to pre-fill customer data for logged-in users, enhance the button code:
What this does:
Checks if customer is logged in (
{% if customer %})Adds customer ID, name, and email if available
Widget pre-fills this data for faster experience
Analytics can track specific customers
Privacy: Only adds data for logged-in users who already shared this info with your store.
Step 5: Test Your Installation
Basic Test
Open your Shopify store (click "View your store" from Admin)
Navigate to any product page
Look for the "Try On π" button
Click it
Expected Result: TrialClouds widget opens in an overlay.
If it doesn't work, see the Troubleshooting section below.
Complete Test
In the widget, upload a test photo (clear face, good lighting)
Wait for AI processing (20-30 seconds)
View the try-on result
Test any additional features (zoom, download, etc.)
Test Multiple Products
Visit different product pages to ensure:
Button appears on all products
Product name changes in widget
Product images load correctly
Prices display accurately
Mobile Testing
Open your store on a mobile device
Navigate to a product
Tap the button
Test uploading from camera or gallery
Verify widget looks good on small screen
Troubleshooting
Widget Doesn't Open
Check:
β Site ID is correct in theme.liquid (no typos or spaces)
β Browser console (F12) for JavaScript errors
β Button has class
trialclouds-trial-widget-trigger-buttonβ Both theme.liquid and product template changes are saved
β Site status is "Active" in TrialClouds dashboard
Test: Type window.TrialClouds_API in browser console. Should return an object (not undefined).
Button Not Visible
Check:
β Product template file was saved
β You're viewing an actual product page (not homepage)
β CSS isn't hiding the button (
display: none,visibility: hidden)β Button isn't positioned off-screen
Debug: Right-click on product page β "Inspect Element" β Search for "trialclouds" to see if button HTML is present.
Images Not Loading in Widget
Check:
β Product has images assigned in Shopify Admin
β Images are visible on product page
β
data-imagesattribute is properly formatted (check page source)
Common Issue: Image URLs with & need proper escaping. The code provided handles this correctly.
Button Styling Looks Wrong
Check:
β CSS file was saved after adding styles
β No conflicting CSS from theme overriding your styles
β Clear browser cache and hard refresh (Ctrl+Shift+R)
Fix Conflicts: Add !important to critical styles:
Works on Desktop But Not Mobile
Check:
β Button CSS includes mobile responsive styles
β Theme's mobile layout isn't hiding elements
β Test on actual device (not just browser responsive mode)
β Touch events work (script handles both click and touch)
Need More Help?
Email: [email protected]
Advanced Customization
Multiple Button Locations
Want buttons in multiple places? Copy the button code to multiple locations:
Both buttons will work β clicking either opens the widget with the same product data.
Conditional Display
Show button only for specific collections or products:
Or by collection:
Custom Button Text by Product Type
Icon Instead of Emoji
Replace text with an image/icon:
Updating the Installation
When TrialClouds releases updates to the widget script:
Good News: The script URL stays the same, so updates are automatic!
Your manually added code doesn't need changes. The widget script at https://widget.trialclouds.com/script/{SITE_ID} is updated on our end, and your site automatically uses the latest version.
If we release a new button code version (rare), we'll email you with update instructions.
Removing the Installation
Remove embed script from theme.liquid:
Edit theme.liquid
Delete the TrialClouds script lines
Save
Remove button code from product template:
Edit your product template file
Delete the button HTML code
Save
Optional: Remove CSS:
Edit your CSS file
Remove TrialClouds button styles
Save
Removing code doesn't delete your TrialClouds account or analytics. Login to https://app.trialclouds.com to manage your account.
Comparing Installation Methods
Theme version
β All themes
Online Store 2.0 only
Code editing
β Required
β Not required
Setup time
15-20 minutes
5-10 minutes
Visual customization
CSS required
Built-in settings
Button placement
β Full control
Limited to block positions
Custom styling
β Complete
Limited options
Theme updates
β οΈ May need reapplication
β Survives updates
Multiple locations
Manual duplication
Easy (add multiple blocks)
Conditional display
β Full Liquid control
Limited
Recommendation: Use app installation unless you need advanced customization or have an older theme.
Need help with manual setup? Email [email protected]
Want the easier method? Try Shopify App Installation instead.
Last updated