Prepare for technical interviews with questions by technology, clear explanations, step-by-step solutions and code you can run.
Shopify is a hosted e-commerce platform. It gives me the store, hosting, checkout, payments and inventory tools, so I can sell online without managing servers.
Shopify is hosted and managed, so setup is quick and security and uptime are handled for me, but I pay a subscription and have less control over the backend. WooCommerce is a WordPress plugin that's free to install, but I manage hosting, updates and security myself.
A product is the item for sale. Variants are its options, like size and color, each with its own price, SKU and stock. A collection is a group of products, like "Summer Sale", either picked by hand or built from rules (automated).
The back office where merchants manage products, orders, customers, discounts, apps, themes and settings.
The set of files that controls how the storefront looks and behaves. It includes Liquid templates, CSS, JavaScript and settings. Merchants can customize it in the theme editor.
Shopify's templating language. It uses {{ }} to output data, {% %} for logic like loops and conditions, and filters like | money to format values.
Online Store 2.0 is the modern theme architecture. Its key idea is that every page can use JSON templates made of sections, so merchants can add, remove and reorder sections on any page, not only the home page.
A section is a customizable area of a page, with its own schema. Blocks are repeatable pieces inside a section, like individual slides. Snippets are small reusable Liquid files rendered with {% render %}.
layout holds the main wrapper, templates hold page types, sections and snippets hold reusable parts, assets hold CSS, JS and images, config holds settings, and locales hold translations.
Metafields store extra custom data on products, customers, orders and other resources, like "material" or "care instructions". Metaobjects are custom content types, like a "Designer" entry with a name, photo and bio, that can be reused across the store.
The Storefront API is for customer-facing experiences, like reading products and building carts in a custom storefront. The Admin API is for back-office work, like managing products, orders and inventory, and needs stricter access.
GraphQL lets me ask for exactly the fields I need in one request. Shopify now treats GraphQL as the main API, and its Admin REST API is considered legacy, so new apps should use GraphQL.
Shopify releases versioned APIs on a regular schedule, and each version is supported for a limited time. I pin my app to a specific version and update it regularly so it doesn't break.
Messages Shopify sends to my server when something happens, like orders/create. I must verify the HMAC signature to confirm the request really came from Shopify.
A custom app is built for one store, often just for that merchant's needs. A public app is distributed through the Shopify App Store to many merchants and goes through a review.
The flow where a merchant approves the permissions (scopes) my app asks for, and Shopify gives my app an access token. I request only the scopes I really need.
The command-line tool for building apps and themes. It can create projects, run a local dev server with hot reload, and push changes.
Small pieces of server-side logic that run inside Shopify's backend to customize things like discounts, shipping options and payment methods. They are compiled to WebAssembly, so they're fast and don't need my own server.
The modern way to customize checkout using checkout UI extensions, Functions and the Customer Accounts. It replaces editing checkout.liquid, which is deprecated, and makes checkout upgrade-safe.
Pieces of an app that run inside Shopify, like theme app extensions (blocks added to a theme), checkout UI extensions, and admin UI extensions. They avoid editing theme code directly.
Shopify Payments is Shopify's built-in processor, available in supported countries. Third-party gateways can be used instead, but they may add transaction fees. Availability depends on the country.
Shopify can calculate taxes based on location, shipping through rates and zones, and discounts through codes or automatic rules. Custom logic can be added with Functions.
Headless means the storefront (frontend) is built separately and talks to Shopify through APIs. Hydrogen is Shopify's React-based framework for headless storefronts, and Oxygen is its hosting. It gives full design control but needs more development effort.
Compress and lazy-load images, keep apps and scripts to what's needed, use clean semantic headings, write unique titles and meta descriptions, add structured data and keep a good mobile experience. Core Web Vitals are a common measure.
Shopify handles PCI compliance for the checkout and hosting. I should use strong staff permissions and two-factor authentication, install only trusted apps, verify webhooks, protect tokens, and follow privacy laws like GDPR for customer data.
Use Liquid output tags with money filter and image_url helper with lazy loading.
<h1>{{ product.title }}</h1>
<p>{{ product.price | money }}</p>
{% if product.featured_image %}
<img src="{{ product.featured_image | image_url: width: 600 }}"
alt="{{ product.featured_image.alt | escape }}"
width="600" loading="lazy">
{% endif %}
Iterate collection.products with for loop and check product.available flag.
<div class="grid">
{% for product in collection.products %}
<a href="{{ product.url }}">
<h3>{{ product.title }}</h3>
<span>{{ product.price | money }}</span>
{% unless product.available %}<em>Sold out</em>{% endunless %}
</a>
{% else %}
<p>No products found.</p>
{% endfor %}
</div>
Compare compare_at_price against price and compute saved amount using minus filter.
{% if product.compare_at_price > product.price %}
<s>{{ product.compare_at_price | money }}</s>
<strong>{{ product.price | money }}</strong>
{% assign saved = product.compare_at_price | minus: product.price %}
<span>You save {{ saved | money }}</span>
{% else %}
<strong>{{ product.price | money }}</strong>
{% endif %}
Use {% form 'product', product %} tag with select element bound to name='id'.
{% form 'product', product %}
<select name="id">
{% for variant in product.variants %}
<option value="{{ variant.id }}" {% unless variant.available %}disabled{% endunless %}>
{{ variant.title }} - {{ variant.price | money }}
</option>
{% endfor %}
</select>
<input type="number" name="quantity" value="1" min="1">
<button type="submit">Add to cart</button>
{% endform %}
Define section HTML with Liquid settings and declare schema JSON at the bottom.
<!-- sections/hero-banner.liquid -->
<section class="hero" style="background-image:url({{ section.settings.image | image_url: width: 1600 }})">
<h2>{{ section.settings.heading }}</h2>
<a href="{{ section.settings.button_link }}">{{ section.settings.button_text }}</a>
</section>
{% schema %}
{
"name": "Hero banner",
"settings": [
{ "type": "text", "id": "heading", "label": "Heading", "default": "Welcome" },
{ "type": "image_picker", "id": "image", "label": "Background image" },
{ "type": "text", "id": "button_text", "label": "Button text", "default": "Shop now" },
{ "type": "url", "id": "button_link", "label": "Button link" }
],
"presets": [{ "name": "Hero banner" }]
}
{% endschema %}
Iterate section.blocks in Liquid and define block settings array in schema.
<!-- sections/faq.liquid -->
<section>
{% for block in section.blocks %}
<details {{ block.shopify_attributes }}>
<summary>{{ block.settings.question }}</summary>
<p>{{ block.settings.answer }}</p>
</details>
{% endfor %}
</section>
{% schema %}
{
"name": "FAQ",
"blocks": [{
"type": "item",
"name": "Question",
"settings": [
{ "type": "text", "id": "question", "label": "Question" },
{ "type": "textarea", "id": "answer", "label": "Answer" }
]
}],
"presets": [{ "name": "FAQ" }]
}
{% endschema %}
Create snippet file and call with {% render 'price-tag', amount: product.price %}.
<!-- snippets/price-tag.liquid -->
<span class="price">{{ amount | money }}</span>
<!-- Usage in template -->
{% render 'price-tag', amount: product.price %}
Subtract cart.total_price from threshold cents value (e.g. 99900 for 999.00).
{% assign threshold = 99900 %}
{% assign remaining = threshold | minus: cart.total_price %}
{% if remaining > 0 %}
<p>Add {{ remaining | money }} more for free shipping!</p>
{% else %}
<p>You've unlocked free shipping.</p>
{% endif %}
Access product.metafields.namespace.key.value with blank guard.
{% if product.metafields.custom.material != blank %}
<p><strong>Material:</strong> {{ product.metafields.custom.material.value }}</p>
{% endif %}
Declare sections object with type mappings and order array in JSON template.
{
"sections": {
"hero": { "type": "hero-banner" },
"faq": { "type": "faq" }
},
"order": ["hero", "faq"]
}
Wrap loop in {% paginate collection.products by 12 %} and render default_pagination filter.
{% paginate collection.products by 12 %}
{% for product in collection.products %}
{% render 'product-card', product: product %}
{% endfor %}
{% if paginate.pages > 1 %}
{{ paginate | default_pagination }}
{% endif %}
{% endpaginate %}
Use image_tag filter with widths, sizes attribute, and loading='lazy'.
{{ product.featured_image | image_url: width: 800 | image_tag:
widths: '400, 600, 800',
sizes: '(min-width: 750px) 50vw, 100vw',
loading: 'lazy',
alt: product.title }}
Post JSON payload with variant items to /cart/add.js endpoint.
async function addToCart(variantId, quantity = 1) {
const res = await fetch("/cart/add.js", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ items: [{ id: variantId, quantity }] }),
});
if (!res.ok) throw new Error("Could not add to cart");
return res.json();
}
Fetch /cart.js and update header badge with item_count property.
async function refreshCartCount() {
const cart = await (await fetch("/cart.js")).json();
document.querySelector("#cart-count").textContent = cart.item_count;
}
Post line and quantity to /cart/change.js endpoint.
async function updateLine(line, quantity) {
const res = await fetch("/cart/change.js", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ line, quantity }), // line is 1-based
});
return res.json();
}
Listen to select change event, look up variant by ID and format price string.
const select = document.querySelector("select[name=id]");
const priceEl = document.querySelector("#price");
const variants = JSON.parse(document.querySelector("#variants-json").textContent);
select.addEventListener("change", () => {
const v = variants.find(x => x.id == select.value);
priceEl.textContent = (v.price / 100).toLocaleString("en-IN", {
style: "currency", currency: "INR",
});
});
Send GraphQL query over POST to /api/2025-01/graphql.json with Storefront token header.
const query = `
query {
products(first: 4) {
edges { node { id title handle priceRange { minVariantPrice { amount currencyCode } } } }
}
}`;
const res = await fetch("https://your-store.myshopify.com/api/2025-01/graphql.json", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Storefront-Access-Token": "YOUR_PUBLIC_STOREFRONT_TOKEN",
},
body: JSON.stringify({ query }),
});
const { data } = await res.json();
console.log(data.products.edges);
Use shopify app init/dev and shopify theme init/dev CLI commands.
# App development workflow
npm install -g @shopify/cli@latest
shopify app init # create a new app
shopify app dev # run it locally with hot-preview
shopify app deploy # deploy config and extensions
# Theme development workflow
shopify theme init # start from theme template
shopify theme dev --store your-store.myshopify.com
shopify theme push
Query orders connection with first, sortKey and reverse arguments.
query {
orders(first: 5, sortKey: CREATED_AT, reverse: true) {
edges {
node {
id
name
createdAt
totalPriceSet { shopMoney { amount currencyCode } }
}
}
}
}
Execute productCreate mutation and inspect userErrors array.
mutation {
productCreate(product: { title: "Cotton T-Shirt", vendor: "My Brand" }) {
product { id title }
userErrors { field message }
}
}
Pass X-Shopify-Access-Token header with secret admin token via fetch.
const res = await fetch(`https://${process.env.SHOP}/admin/api/2025-01/graphql.json`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Access-Token": process.env.ADMIN_TOKEN,
},
body: JSON.stringify({ query: "{ shop { name myshopifyDomain } }" }),
});
console.log(await res.json());
Compute HMAC-SHA256 digest of raw request buffer and compare with crypto.timingSafeEqual.
const crypto = require("crypto");
const express = require("express");
const app = express();
app.post("/webhooks/orders-create", express.raw({ type: "application/json" }), (req, res) => {
const hmacHeader = req.get("X-Shopify-Hmac-Sha256");
const digest = crypto
.createHmac("sha256", process.env.SHOPIFY_API_SECRET)
.update(req.body)
.digest("base64");
const valid = crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(hmacHeader || ""));
if (!valid) return res.sendStatus(401);
const order = JSON.parse(req.body.toString());
console.log("New order:", order.name);
res.sendStatus(200);
});
Define access_scopes and webhooks configuration table in toml manifest.
name = "my-app"
client_id = "YOUR_CLIENT_ID"
application_url = "https://my-app.example.com"
embedded = true
[access_scopes]
scopes = "read_products,read_orders"
[webhooks]
api_version = "2025-01"
[[webhooks.subscriptions]]
topics = ["orders/create"]
uri = "/webhooks/orders-create"
Check input.cart.lines quantity threshold and return discount application strategy.
// extensions/bulk-discount/src/run.js
export function run(input) {
const qty = input.cart.lines.reduce((sum, l) => sum + l.quantity, 0);
if (qty < 3) {
return { discounts: [], discountApplicationStrategy: "FIRST" };
}
return {
discounts: [{
targets: [{ orderSubtotal: { excludedVariantIds: [] } }],
value: { percentage: { value: "10.0" } },
message: "10% off for 3+ items",
}],
discountApplicationStrategy: "FIRST",
};
}
Render application/ld+json script with Schema.org Product specifications.
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": {{ product.title | json }},
"image": {{ product.featured_image | image_url: width: 800 | prepend: 'https:' | json }},
"description": {{ product.description | strip_html | truncate: 200 | json }},
"offers": {
"@type": "Offer",
"priceCurrency": {{ cart.currency.iso_code | json }},
"price": {{ product.price | divided_by: 100.0 | json }},
"availability": "{% if product.available %}https://schema.org/InStock{% else %}https://schema.org/OutOfStock{% endif %}"
}
}
</script>
Try searching for keywords like "JWT", "Express", "useEffect", "PDO", "GIL", or "schema".
Connect with DigitalXNode expert interviewers for technical mock interviews, domain assessment, and enterprise job placement.