# Adding Custom Fields Data (Metafield Data) to the Product Page

This is advanced guide, so please make sure you have understand our app well before going forward. If you are still not sure or have not gone through ACF’s basic knowledge, we recommend you go to Advanced Custom Field.

Our examples were created on Shopify’s Debut theme. These examples require to edit theme code, so users need to have some coding knowledge. Different theme may also has different source code but overall the theme structure should be the same since they are all Shopify themes.

In case you have problem applying any examples here to your theme, please submit a support request via our Support Portal; or send email to [email protected].

# ◾️ Displaying Custom Fields as Bullet Points on Product Pages

In this advanced guide, we’ll show you how to use ACF to create a bullet list displayed to customers on products. This is another example to show you how you can utilize ACF.

  • Step 1: At Fields tab, choose resource Products and create a HTML field.

  • Step 2: Click Save button to save your changes; then go to Editor tab’s resource Products and pick a product to start with.

  • Step 3: On next page, click Unordered list and add content you want.

  • Step 4: Click Save button to save your changes.

  • Step 5: Go to Edit code, open file product-template.liquid. In that file, search keyword product__price, then add the following code:

{% if product.metafields.namespace.key != blank %}
  <div class="metafield-bullet-points">{{product.metafields.namespace.key}}</div>
  <style>
    .metafield-bullet-points {
        margin-top: 1rem;
        margin-left: 20px;
        margin-right: 20px;
    }
    .metafield-bullet-points ul li {list-style: initial;}
  </style>
{% endif %}

  • Step 6: Click Save button to save your changes.

If the above steps are done correctly, the result should be displayed on corresponding product page.

TIP

Click Preview button to quickly jump to corresponding product page.

# ◾️ Creating a Simple Shipping Policy on Product Pages

In this advanced tutorial, we will guide you through how to create a product field to display as a per-product shipping policy for your customers. This can be useful if you have different shipping times for different types of products.

In this example, we will show you how to achive this:

  • Step 1: At Fields tab, choose resource Products and create a Selection field.
  • Step 2: Click Save button to save your changes; then go to Editor tab’s resource Products and pick a product to start with.
  • Step 3: Pick an shipping policy option for your product variant. When everything is fine, click Save button to save your changes.
  • Step 4: Go to Edit code, open file product-template.liquid. In that file, search keyword product-single__description, then add the following code:
{% if product.metafields.namespace.key != blank %}
  <div class="shipping-policy">
    <h2>Shipping Policy</h2>
    <p>This item takes {{product.metafields.namespace.key}} to ship.</p>
  </div>
{% endif %}

  • Step 5: Click Save button to save your changes.

If the above steps are done correctly, the result should be displayed on corresponding product page.

# ◾️ Displaying Text Based on a Checkbox Value on Product Pages

Theme designers can completely control the output and placement of any custom field in the app using some advanced techniques.

Some possible uses include creating a banner image on every product page, creating a header message area, showing different icons based on product attributes, and many other custom uses.

In this example, we’ll add a checkbox to our products that will show one message if checked and another if it’s not checked, but you can adapt this example for many other uses.

  • Step 1: At Fields tab, choose resource Products and create a Checkbox field.
  • Step 2: Click Save button to save your changes; then go to Editor tab’s resource Products and pick a product to start with.
  • Step 3: Check the Recyclable? and click Save to save your changes.
  • Step 4: Go to Edit code, open file product-template.liquid. In that file, search keyword product__price, then add the following code:
{% if product.metafields.namespace.key == 'true' %}
  <p>This product is recyclable</p>
  {% else %}
  <p>This product is not recyclable</p>
{% endif %}

  • Step 5: Click Save button to save your changes.

If the above steps are done correctly, the result should be displayed on corresponding product page.