Custom Product – Recommended Product using Custom Product Metaied Definition (Liquid)

Custom Product – Recommended Product using Custom Product Metaied Definition (Liquid)

KaitlynAbbott
Not applicable
1 0 0

We've created a custom product page, similar to the default, but we've added several custom product metafield definitions assigned to a specific category. The purpose of this collection is an online gallery that is up for a short time. We have some works of art from multiple artists, and we'd like to show users other works from the same artist on the product (very specific product recommendation).

Screenshot 2025-04-04 at 9.44.53 AM.png

Visual Reference: https://shop.visitcherokeenation.com/products/bejeweled

 

Near the bottom of the product page, we have an info section with tabs containing details about the product as well as a tab specifically showing other works that the particular product artist has in the show. For example:

Product Page – Art Show 2025, Artwork 1, John Doe

Product page contents

 

 

More from the Artist (Product Recommendation Module)

Art Show 2025, Artwork 2, John Doe

Art Show 2025, Artwork 3, John Doe

 

Conditionally, if an artist has more than one piece, we've assigned a specific tag which call up the 'Other Works' tab if it's been assigned (working great). The artist's name is a product metafield definition assigned to the correct category. For the recommended product section, below is the code I'm using to try and call only other products with the same metafield definition as the current selected product:

 

{%- unless template == 'index' or template == 'cart' or template == 'list-collections' or template == '404' -%}
{%- assign t = template | split: '.' | first -%}
{% assign related_products = product.metafields.custom.gallery_002_artist_name.value %}
{% assign limit = 3 %}

 

{% if product.vendor == product.vendor %}
{% if product.tags contains 'Multiple Entries' %}

 

<div id="More" class="tabcontent">
<div class="tab-content-section">

 

<div class="product-recommendations">

<div class="page-width" data-limit="{{ limit }}">

<div class="section-block">

<div class="grid grid--no-gutters grid--uniform">

 

<div class="grid__item small--one-half medium-up--one-third">

{%- include 'gallery-product-card', product: product, collection: collection -%}

</div>

 

</div>

</div>

</div>

</div>

 

</div>

</div>

 

{%- endif -%}
{%- endif -%}

{%- endunless -%}

 

Additional Info that may help:

Product Name: product.name

Product Vendor: product.vendor

Artist Name: product.metafields.custom.gallery_002_artist_name.value

 

 

I've attempted to copy and paste directly from product-recommendations.liquid to start the setup but event the results aren't populating.

 

Any help is appreciated!

 

Reply 1 (1)

Shadab_dev
Shopify Partner
1330 66 148

Hey @KaitlynAbbott will definitely recommend you to watch this tutorial on metaobjects. The guy uses kind of the same example here to explain this as your requirement is. 

 

There are definitely other alternatives but this is more a manual setups where you might probably not need code. 

 

Hope this helps. In case you need help anyways, please reach out via personal links below for a convenient conversation and collaboration.

 

Best

Shadab

Buy me Coffee, if you feel i was helpful. Email Me here or WhatsApp me with this link for any help with shopify theme customizations or any project in web dev. If this is helpful, please Like and Accept the solution.