I tried this but not working
{% assign sectionImage = "" | split: ',' %}
{% assign sectionTitle = "" | split: ',' %}
{% assign sectionDescription = "" | split: ',' %}
{% for n in (1..5) %}
{% assign varCount = "section_" | append: n %}
{% assign varImage = varCount | append: '_image' %}
{% assign varTitle = varCount | append: '_title' %}
{% assign varDescription = varCount | append: '_description' %}
{% assign sectionBase = product.metafields.my_fields[varTitle] %}
{% if sectionBase %}
{% assign sectionImage = sectionImage | push:product.metafields.my_fields[varImage] | file_url %}
{% assign sectionTitle = sectionTitle | push:product.metafields.my_fields[varTitle] %}
{% assign sectionDescription = sectionDescription | push:product.metafields.my_fields[varDescription] %}
{% else %}
{% break %}
{% endif %}
{% endfor %}
Hi @Lonecrowlab ,
I am Anni From https://www.task4store.com/ - Shopify Small & Custom Tasks Experts ( By MS Web Designer - Top Rated Shopify Certified Experts and eCommerce Consultant from Singapore )
I will love to help you with your concern. Kindly elaborate more on your requirement with these details:
-Your Store URL,
-Also Mention Which Shopify theme you are using
Note: If your store is protected with ‘store Font password’ please Send it here or DM me.
If you have any concerns feel free to ask me!
Regards,
Anni
My store is currently not live. I am using dawn theme. I am plannign to use metafields for product sections. Currently I am doing them manually like this
{% assign sectionImage-1 = product.metafields.my_fields.section_1_image | file_url %}
{% assign sectionTitle-1 = product.metafields.my_fields.section_1_title %}
{% assign sectionDescription-1 = product.metafields.my_fields.section_1_description %}
{% assign sectionImage-2 = product.metafields.my_fields.section_2_image | file_url %}
{% assign sectionTitle-2 = product.metafields.my_fields.section_2_title %}
{% assign sectionDescription-2 = product.metafields.my_fields.section_2_description %}
{% assign sectionImage-3 = product.metafields.my_fields.section_3_image | file_url %}
{% assign sectionTitle-3 = product.metafields.my_fields.section_3_title %}
{% assign sectionDescription-3 = product.metafields.my_fields.section_3_description %}
{% assign sectionImage-4 = product.metafields.my_fields.section_4_image | file_url %}
{% assign sectionTitle-4 = product.metafields.my_fields.section_4_title %}
{% assign sectionDescription-4 = product.metafields.my_fields.section_4_description %}
{% assign sectionImage-5 = product.metafields.my_fields.section_5_image | file_url %}
{% assign sectionTitle-5 = product.metafields.my_fields.section_5_title %}
{% assign sectionDescription-5 = product.metafields.my_fields.section_5_description %}
I want them in for loop so it will be cleaner thanks.