How to associate images with ITEM_VARIATION object without getting duplicate images for the product ITEM

I noticed that if I setup my ITEM_VARIATIONS to have an image, the image switches in the store when the customer chooses the color. I like that. However, when I assign images to the ITEM_VARIATION, then the item ends up with extra images…one for every option. For example, if I have 3 shirt colors and 5 sizes, then I the images will show 15 images and 5 will be identical for each color. Is there a way to reuse the same image without having all of these extra images show up in the UI? I am using the API and telling setting the images in the ITEM_VARIATION to the same image.

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Monitor Sold-out Item Variations or Modifiers
Design a Catalog
Work with Images

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Yes, you can reuse the same image for different item variations. However, the Square Catalog API treats each image assignment as a separate instance, even if the same image is used. This is why you’re seeing multiple instances of the same image in your item.

To avoid this, you could create the image once and then reference its ID when creating your item variations. This way, the same image object is used across all your variations, and you won’t see duplicate images in your item.

Remember that the image displayed in the Square Online Store or Point of Sale will change based on the variation selected by the customer, as long as the variation has an image associated with it.

This answer was reviewed by @Bryan-Square.

Thanks, I will give that a try

I think this is what I am already doing through the APIs. Am I missing something? My process is to first call ‘create catalog image’. Then I call “batch upsert catalog items” with the items and item variations with the image_ids for the variations. What should I do differently?

Thanks!
Gary

Any thoughts on this?

Is this with the Square Online Store or are you also referring to the UI in the Dashboard? :slightly_smiling_face:

The online store.

You made a suggestion on how to configure the variations, but I think that I am already following the suggestion without success.

I am uploading images and collecting the ids.

Then I am creating variations using the image ids.

This makes the connection nice in the UI, but makes the product have lots of duplicate images.

What’s your application ID? :slightly_smiling_face:

I will get it for you when I get home tonight. I will also configure a test product that shows this behavior. Currently I dont have my t-shirts setup in this configuration because I dont like seeing the duplicates. I am guessing that you’d like to look at my account and see an example of how this is all configured, is that correct?

Thanks again btw…I appreciate the support!

Gary

Ok, tonight it is all working. I am calling the API the same way and the images are associating correctly with the variations without duplicates! Thank you so much for the encouragement. I dont know if something changed on your end or if I was doing something wrong before somehow.

Now that it is working, I need to learn how to set a default variation. Is there a way to specify a default ITEM_VARIATION for an ITEM? I noticed that the pictures dont change unless the options are all set to something non-nil.

Gary

At this time the ordinal on the item_variation is read only. The only way to adjust the variations ordinal is in the Seller Dashboard by changing the order of the variations within the item. :slightly_smiling_face:

What I am looking for is a way to pre select a variation. For example, medium blue t-shirt. When nothing is selected for size, I noticed that selecting a shirt color doesn’t show the variation image. So the thought is that if I preselect then there won’t be any confusion for customers.

Is there a way to preselect a variation as the default?

Gary