Integrating Customizer in Shopify

This user guide provides step-by-step instructions for integrating the customizer functionality from VU Custom OS into a Shopify product page.

This process allows you to embed customizer templates created in VU Custom OS directly onto your Shopify store's product detail pages (PDPs).

While these steps are specifically detailed for Shopify, the general principles can be adapted for other e-commerce platforms, though the exact location identification of the product page may differ.

Prerequisites:

  • Access to a Shopify Partners page with collaborator access.

  • Existing templates created within the VU Custom OS.

Overview of Steps:

  1. Create New Template

  2. Add Basic HTML to Render

  3. Add Script to Render Customizer

  4. Select Template in Product Section

Step 1: Log in and Navigate to Code Editor

  1. Log in to your Shopify account via the Shopify partners page.

  2. From the Shopify admin page, navigate to "Online Store".

  3. Click on "Code" to access the theme editor.

Step 2: Create a New Product Template

  1. In the main editor interface, locate and click "Add new template".

  2. When prompted, choose "product" as the type of template.

  1. Give your new template a name, for example, "new-test". Take a note of the template name for further reference.

Step 3: Create a New Section and Copy Schema

  1. Create a new section that corresponds to your new template. The section name should be the same as your template name, e.g., "new-test". The full file name will typically be product.new-test.liquid.

  1. Ensure that the type parameter within the section's schema matches the section name (e.g., type: "new-test").

  1. To provide a base for your new PDP page, you need a schema to replace the default schema code populated.

  1. Copy the schema from the default product detail page (PDP) in Shopify. This is found in sections/main-product.liquid.

  • Scroll to the bottom of the main-product.liquid file to find the schema section or Search for “schema”.

  • Copy this entire schema section.

  1. Paste the copied schema into your newly created section file (e.g., sections/new-test.liquid).

  2. Save the section file.

Note: : If there are any errors in the schema, the system will not save it and will pop up an error message, which you can use to resolve the issue.

Step 4: Add Minimal HTML and Script to Embed Customizer

  1. Obtain the minimal HTML and script required to embed the customizer. An example of minimal HTML includes a div with a specific style and class, and a script part.

<div id="customizer-root">
  <div class="middleScreen flex">
    <div class="flex pr-12 wrapper1">
      <div id="customizer-root">
        <div
          style="position: relative"
          class="customizer-main-perspective-wrapper"
        >
          <div id="customizer-main-perspective"></div>
        </div>
      </div>
    </div>
    <div class="sideBar">
      <div style="display: flex; justify-content: space-between; align-items: center;">
        <div class="product-custom-info">
          <h1 class="customizer-product-name"></h1>
          <h2 class="customizer-price"></h2>
        </div>

        <div class="flex justify-center mt-2 gap-2">
          <div class="top-right-buttons">
            <button title="Save Wishlist" id="customizer-save-button">Save</button>
            <button title="Share Link" id="customizer-share-button">Share</button>
          </div>
        </div>
      </div>

      <div class="element-wrapper">
        <div id="customizer-tab-container" style="display:none;"></div>
        <div id="customizer-tab-body-container"></div>
        <div class="card" style="display:none;">
          <div class="card-body">
            <div
              style="display: flex; justify-content: center"
              class="pointer-icon"
            >
              <div>
                <span id="tab-prev"></span>
                <span id="tab-next"></span>
              </div>
            </div>
          </div>
        </div>

        <div class="card" style="display:none>
          <div class="card-header">Summary</div>
          <div class="card-body">
            <div id="customizer-summary-items" class="font-14"></div>
          </div>
        </div>
      </div>
      <div class="flex justify-center mt-18">
        <button class="add-to-bag customizer-add-to-cart-button btn">Add to Bag</button>
      </div>
    </div>
  </div>
</div>
<script
  id="customizer"
  src="https://vu-customizer.s3.amazonaws.com/production/main.js"
  data-variant="47177649783034"
></script>
  1. Paste this HTML and script into the wrapper div within your new template file (e.g., templates/product.new-test.liquid).

  2. Configure the Product ID within the HTML script:

  • The script contains an ID that connects to a specific product template from VUCustom OS.

  • To get a static product ID: Navigate to VUCustom OS, go to the "Template" section, and then find the "Link product" section. The ID will be available in the URL.

  • For a dynamic product ID (recommended): Instead of a static ID, you can use a dynamic tag. This tag will automatically populate the correct product ID based on which product's PDP is being viewed. This means the same template can work for multiple products without manual ID changes.

<script 
    id="customizer" 
    src="https://vu-customizer.s3.amazonaws.com/production/main.js" 
    data-  variant="{{ product.selected_or_first_available_variant.id }}"
></script>
  1. Save your new template file.

Step 5: Select the New Template for a Product

  1. After both your section and template files are saved correctly, you need to apply this new template to your Shopify products.

  2. Navigate to the "Product" section in your Shopify admin.

  3. Choose a specific product (e.g., "snicker") for which you want to enable the customizer.

  4. Under the product's settings, select your newly created PDP template (e.g., "new-test") from the available templates.

  5. Save the product settings. The product page will now display with your new customizer template.

Additional Information:

  • After the minimal configuration, you can further customize the customizer's appearance and position using CSS (Cascading Style Sheets). This involves designing the "skin" or shifting the position of the div element to match your design requirements.

  • You have the option to create multiple templates if needed, each linked to different customizer designs or functionalities.

Last updated