Ad

Add Multiple Image Upload In Shopify

- 1 answer

I'm new in shopify. Please can anybody help me for adding a custom multiple image upload section in settings_schema.json

Here is my code -

{
    "name": "Banner",
    "settings": [
      {
        "type": "header",
        "content": "Image Options"
      },
      {
        "type": "checkbox",
        "id": "use_img",
        "label": "Use Custom Banner?"
      },
      {
        "type": "image",
        "id": "start_page_bg.jpg",
        "label": "Custom Banner",
        "max-width": 1200,
        "max-height": 1200
      },
      {
        "type": "paragraph",
        "content": "Recommend the optimal width and height for your banner here."
      }
    ]
  }

That was for single image upload. I want to upload multiple images for banner

Ad

Answer

Shopify doens't have a multiply field option at the moment.

Recently Shopify included a Sections option, where there is an option for multiply images, but this will be true only for the homepage ( or where you include the content_for_index tag).

There are a few ways you can workaround this issue:

1) Create multiply fields with id's image_1.jpg, image_2.jpg, image_3.jpg etc.. and loop them with a for loop. But it will be required for them to always be visible in the settings page.

2) Create a navigation field and create a navigation with Web Address type links, where the web address will point to the image. You will loop the links of that navigation and use them as images.

3) Create a blog field and create a separate blog, where you will be able to create post using that blog, where each post can use a featured image. You will loop the post from that category and you will have access to the images.

Ad
source: stackoverflow.com
Ad