Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Line item customAttribute image upload

Line item customAttribute image upload

hamblyfreeman
Shopify Partner
3 0 0

We are currently speccing a job that will involve the requirement for having an option for the customer to upload an logo or image as part of a customisation of a product. We have worked out how to apply custom attributes to the line items, but we are struggling to work out how we might tap into the file upload fields that the liquid themes are seemingly able to use. Is this possible via the Storefront API?

The only workaround we can figure out otherwise is some kind of third party upload API to generate a URL we can pass to the line item, but that's very much a last resort if possible! Fingers crossed one of you clever lot have the answer!

Replies 2 (2)

Liam
Community Manager
3108 342 884

Hi Hamblyfreeman,

 

From looking into this more, it does seem that you would need to upload the image or file to a separate server or a file hosting service to get a URL for the file, then add this URL as a line item property on the order. 

 

Services like AWS, Google Cloud Storage, or Cloudinary can be used for uploading/ storing images and generating URLs. Once you have a URL you can use the checkoutLineItemsAdd mutation to add  line item objects to add to the checkout.

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

hamblyfreeman
Shopify Partner
3 0 0

Thanks Liam, we expected so, but was worth asking in case there was a way to do it natively! Thanks for taking the time to answer 🙂