Hi there, I have a sub-site on Shopify and I want to show 2 different images for 2 different target audiences for same product. For example I have 2 target groups and I want to show them different pictures of the same product base on them age or other indicator. Is it possible? I tried to find it on help center and FAQ but without success.
Regards,
Insaneebayseller
Hi @Insanebayseller ,
Use meta field to upload product images for 2 groups of customers. Then display those images with the condition like using tags given to customers on the product page. For example, If some customers tagged “adult“ then apply the condition on the product page that if customers have an “adult” tag then display the first metafield image or else display the second metafield image.
Thank you.
Hi @Insanebayseller ,
Use meta field to upload product images for 2 groups of customers. Then display those images with the condition like using tags given to customers on the product page. For example, If some customers tagged “adult“ then apply the condition on the product page that if customers have an “adult” tag then display the first metafield image or else display the second metafield image.
Follow below steps to complete this task. consider dawn theme for below code.
-
Create two product meta fields for 2 different customers to upload different product images.
-
Add specific tags to customers. for example, Create “adult“ and “kids“ tags and then assign to customers.
-
Add below code to product page “main-product.liquid“ file. This code is for above tags. You can change it with your own tags.
{% if customer %}
{% if customer.tags contains "adult" %}
{% assign file_object = product.metafields.my_fields.image_for_adult.value %}
{% elsif customer.tags contains "kids" %}
{% assign file_object = product.metafields.my_fields.kids_image.value %}
{% endif %}
{% endif %}
Thank you.