Ad

Post File To Shopify URL

- 1 answer

I have produced an ASP.NET/MVC Web application where a user uploads a file, I then take that file and generate a new file based on server-side calculations. This new file is saved server-side.

I then need to post this new file to my client's Shopify URL via a Submit button (the end user will see this file and can then select 'Add to Cart').

I've been doing some looking around (e.g. 'post file to Shopify URL?') and the search results returned relate to either uploading files to your Shopify account through the Shopify admin console, or, a Shopify form post to external URL - this is not what I want - I need to post to Shopify from an external URL.

Is it possible to post a file to a Shopify URL? and if so, presumably this could be done using JSON? Can I use the Shopify API to do this? Presumably I'd need Shopify username / password credentials from the client to do this?

As you can tell(!) I'm a newbie to Shopify development so please forgive the seemingly straight-forward questions, but some guidance would be greatly appreciated, Thanks

Ad

Answer

You should be using Shopify to upload the file. In product.liquid you can do this, and the file is saved along with the order as a product's line item property. When the order is booked, you can listen for that event, then use API calls to get the order and the image the customer uploaded. At that point you manipulate the image or file as you wish.

You cannot POST a file to Shopify in the sense of making a product that then goes in the cart. What you could do is POST to your server, use the API to generate a new product with that file as part of the new product, then show that new product off to the customer. A lot of work in that pattern for sure!

Anyway, your question in the context of Shopify and how it works is too difficult to answer here with much more detail, especially without you saying what it is you are trying to actually do.

Ad
source: stackoverflow.com
Ad