I am facing issue for adding thumbnail to the custom item created using draft order API and while searching for the solution I got following topic by @Ben_Hart :
"I've created an app that uses the shopify draft order api to create a number of custom items based on interactions in the app, so that the customer can checkout their items using shopify.
I'd like to add image thumbnails to the items, ideally just by supplying a URL to the image file, yet I can't seem to find a way to do this in the API reference. (https://help.shopify.com/en/api/reference/orders/draftorder)
when Creating a draft order via API call using custom line items, rather than existing products, is there a way to add thumbnail images on those custom line items?"
This topic is posted on "09-19-2018" and till date there is no solution/reply posted on this topic.
When I contact to the shopify support, they says please post on community forum and our shopify experts will post solution there.
Now my question is "This is how we are going to get the solution?"
Please help here as soon as possible.
At this time we do not support images being added to custom line items. Sorry we evidently didn't get to the prior thread at the time this was posted, otherwise your question might have been answered by now.
We would also like to request this feature. It does seem very strange to display the default product thumbnail for a custom line item when it is impossible to ever replace it with a real product thumbnail.
It is possible. Need to attach image to product (ProductImage API), create product variant with image_id (ProductVariant API), and then create draft order (DraftOrder API) based on variant_id (option1 is mandatory) and not product_id. Otherwise if draft order is being created directly from product without variant, it seems Shopify is internally creating a variant which does not get image linked.
If my observations are right, that will never work due to how Shopify is designed. Images need to be uploaded separately to product (max 250 images), and from there they can be linked. Line item seems to be just a variant - so either you create variant manually where you have full control, or you try to create line item directly from product, which seems to be a shortcut of creating variant without image. I don't expect Shopify would change it's product structure to allow images from outside of product (otherwise that I guess could be security hole). Maybe if they do implement some new internal image storage which is not tied to product, but even then it would break the philosophy in how images are tied to products.
That said I don't see much difference in just uploading a new image to product and creating a variant with it (in my case I'm creating a new product too, so happily I don't need to worry about 250 images limit per product).