Customize theme components
This guide shows you how to customize the Shopify plugin components to match your theme's design. You'll learn to override the default components by creating custom PHP files in your theme directory.
Anchor to Before you startBefore you start
You need:
- Write access to your WordPress theme files and directories
- Understanding of WordPress theme structure
- Basic knowledge of PHP and HTML
Anchor to Customize Product Card componentsCustomize Product Card components
The Product Card Component appears in product listings and collection pages, showing key product information like image, title, and price.
Anchor to Step 1: Create the override fileStep 1: Create the override file
Create a file named product-card.php
in a Shopify
folder within your theme directory:
Anchor to Step 2: Copy the default codeStep 2: Copy the default code
Add this default code to your product-card.php
file:
{theme_dir}/shopify/product-card.php
Anchor to Step 3: Customize the componentStep 3: Customize the component
Now you can modify the HTML structure, CSS classes, or add custom styling. For example, to add a custom wrapper class:
Anchor to Customize Product Quick ViewsCustomize Product Quick Views
The Product Quick View modal displays when customers click "Quick Shop" on product cards, showing product details without leaving the current page.
Anchor to Step 1: Create the override fileStep 1: Create the override file
Create a file named modal.php
in a Shopify
folder within your theme directory:
Anchor to Step 2: Copy the default codeStep 2: Copy the default code
Add this code to your modal.php
file:
{theme_dir}/shopify/modal.php
Anchor to Step 3: Customize the modalStep 3: Customize the modal
You can customize the modal layout, styling, or button text. For example, to change the close button:
Anchor to Customize Product Detail PagesCustomize Product Detail Pages
The Product Detail Page shows the full product information including images, variants, description, and purchase options.
Anchor to Step 1: Create the override fileStep 1: Create the override file
Create a file named pdp.php
in a Shopify
folder within your theme directory:
Anchor to Step 2: Copy the default codeStep 2: Copy the default code
Add this code to your pdp.php
file:
{theme_dir}/shopify/pdp.php
Anchor to Step 3: Customize the product pageStep 3: Customize the product page
You can modify the layout, add custom fields, or change the styling. For example, to add a custom section:
Anchor to Customize CollectionsCustomize Collections
The Collection Component displays groups of products from your Shopify collections on collection pages.
Anchor to Step 1: Create the override fileStep 1: Create the override file
Create a file named collection.php
in a Shopify
folder within your theme directory:
Anchor to Step 2: Copy the default codeStep 2: Copy the default code
Add this code to your collection.php
file:
{theme_dir}/shopify/collection.php
Anchor to Step 3: Customize the collection displayStep 3: Customize the collection display
You can modify how products are displayed in collections. For example, to change the number of products shown:
Anchor to Advanced: Server-Side RenderingAdvanced: Server-Side Rendering
For better SEO, you can implement Server-Side Rendering (SSR) by fetching data directly from the Shopify Storefront API in your PHP files instead of using the Storefront Web Components.
Anchor to Benefits of SSRBenefits of SSR
- Improved SEO: Search engines can crawl the fully rendered HTML
- Faster initial load times: Content is ready when the page loads
- Better accessibility: Screen readers can access the content immediately
Anchor to Implementation approachImplementation approach
When implementing SSR, your custom PHP files will:
- Fetch data directly: Use the Shopify Storefront API to get product/collection data
- Render HTML server-side: Generate the complete HTML structure in PHP
- Handle pagination: Create custom pagination logic since you won't use the default web components
Note that SSR requires more development complexity and a deeper understanding of the Shopify Storefront API, but provides significant SEO benefits for product and collection pages.