Best answer

How to create file url from file name, order ID and product ID from WooCommerce?

  • 3 October 2021
  • 2 replies
  • 278 views

A quick question for those of you who are more experienced with Zapier than I am! I am bringing order info into Zapier from WooCommerce, when I do so I end up with a data field that appears as follows:

1. Line Items Meta Data Upload
o_1fh1goor91fnf1a90a421i8g1je79.png, o_1fh1gr7nb1ngug7l13111tic20q9.jpeg

The filenames listed are files that a customer has uploaded during checkout. For some reason, the form I use only passes along the filename and not the full file URL. I need to create the full file URL as a new variable / data field to then use in another step afterwards.

The full URLs of the filenames listed above are as follows:
https://8gd.a71.myftpupload.com/wp-content/uploads/ppom_files/confirmed/5705/3093-o_1fh1goor91fnf1a90a421i8g1je79.png
https://8gd.a71.myftpupload.com/wp-content/uploads/ppom_files/confirmed/5705/2980-o_1fh1gr7nb1ngug7l13111tic20q9.jpeg

The number 5705 in the URL is the order number, and the prefixes 3093- and 2980- are Product ID’s that also get passed along to Zapier. I have a simple formula that allows me to take the Filename, Order ID, and Product IDs and end up with the full URL, which is as follows:

https://8gd.a71.myftpupload.com/wp-content/uploads/ppom_files/confirmed/”[OrderID]/[ProductID]-[Filename]

I know how I would do this for example using PHP, with which I am more experienced:

$fullURL = “https://8gd.a71.myftpupload.com/wp-content/uploads/ppom_files/confirmed/” . $OrderID . “/” . $ProductID . “-” . $Filename;

How can I do this with Zapier??

icon

Best answer by IdleWilde Printing 3 October 2021, 19:39

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Well, now I feel stupid for asking, as talking it through in my head while making the post helped me realize what I needed to do.

Got it to work using Formatter > Transform > Spreadsheet-style Formula, with the formula being:

= "https://8gd.a71.myftpupload.com/wp-content/uploads/ppom_files/confirmed/" & "{{134055002__id}}/" & "{{134055002__line_items[]product_id}}-" & "{{134055002__line_items[]meta_data_upload}}"

 

Userlevel 7
Badge +14

Hi @IdleWilde Printing 

If you know coding such as JavaScript or Python, then you can use a Code step: https://zapier.com/apps/code/help

 

Otherwise, try using a Formatter step: https://zapier.com/help/doc/how-use-formatter-functions