Skip to main content

Shopify Integration

This guide shows how to integrate the PixCraft API into a Shopify store using a combination of Liquid templates and JavaScript.

Architecture

Since Shopify doesn’t allow server-side API calls from Liquid, you’ll need a small backend proxy:
  1. Backend proxy (Node.js, PHP, or serverless function) — holds your API key and calls PixCraft
  2. Shopify theme snippet — shows the configurator UI on product pages
  3. JavaScript — handles user interaction and calls your proxy

Step 1: Create a backend proxy

Deploy a simple serverless function (Vercel, Netlify, or Cloudflare Workers):

Step 2: Add the Liquid snippet

Create snippets/pixcraft-configurator.liquid:

Step 3: Include in your product template

In sections/product-template.liquid or your product page template:

Step 4: Product metafields (optional)

Use Shopify metafields to configure which niche each product uses:
  1. Go to Settings → Custom data → Products
  2. Add a metafield: namespace pixcraft, key niche, type single line text
  3. Set the niche ID (e.g., mosaics, curtains) on each product
The Liquid snippet reads this via {{ product.metafields.pixcraft.niche }}.

Security note

Never expose your PixCraft API key in client-side code. Always route requests through your backend proxy.