Woocommerce Digital Download Products URLs

Hey,

I’m having trouble figuring out how to upload multiple Downloads to Woocommerce.

For example, my Google spreadsheet has this data:
Captura de tela 2024-03-19 112627

I am unable to place this data in the array of the Woocommercce Update a Product module.

Any suggestion? Thanks!

Hey @pachecothiago,

I see that your text is separated by |. So one way we could tackle this is by splitting the text string, and throwing it into an array.

Like this:
Input:

Split the text by | and put it into an Array:


image

But that’s not really optimal :slight_smile: .

An alternative solution is to combine the add() formula with the split function like this:
image

This then gives this output:
image

Hope that helps!

Thomas - Nola Digital

2 Likes

Thank you for your kindness @NolaDigital

I tried this:
Captura de tela 2024-03-19 151336

But I got this error:

What am I doing wrong?

@pachecothiago sorry, I missed the fact that those values are inside an array Row Values[] as well :slight_smile:

In case there’s only one row in that Row Values [] we can approach it a bit differently. I made a test array that simulates your:

image

And we can get the S and T values like this:

By adding the get() function, we can get the S and T values from the first item in the array (hence the 1.S notation).

Doing this, then gives me the following result:
image

Hope that helps!

Thomas

3 Likes

@NolaDigital I appreciate your efforts to help,

I did as you suggested:

But I can’t put it in this location:

How can I do it?
I imagine I should click on Map

Tks!

Can anyone help me with this issue? Thanks!

Hey Thiago,

I think you’ll need to replicate the Array that’s in the downloads. What if you create a test product via the WooCommerce front end? With uploads & URLs etc. And then get the product details from that one?

How does the downloads array look like there? If we know in which format Woo wants it, we can rebuild it that way.

My multiple variables setup was more to serve as an example, and I don’t think adding that as I demoed it to your scenario will help. I think we’ll need to come up with a way to replicate the Array Woo wants.

Can you share an example of that?

Thomas - Nola Digital

2 Likes

Hey Thomas!

I created a product in Woo and brought it to Google Sheets.

The download output here:

"downloads": [
            {
                "id": "20e3fc76-ec2c-4cfd-bad3-accb3f73602d",
                "name": "Download 1",
                "file": "https://drive.google.com"
            },
            {
                "id": "024d5bdb-862a-4f2d-be0b-a45d9ccd94c7",
                "name": "Download 2",
                "file": "https://drive.google.com"
            },
            {
                "id": "6ffe2a07-b467-461c-b7da-6a80ffba2d4c",
                "name": "Download 3",
                "file": "https://drive.google.com"
            }
        ]

I don’t know if that’s what you’re asking for.

Captura de tela 2024-03-27 154826

Tks!!

Okay, so I spent a bit of time replicating this :sweat_smile:

But with this setup, you’ll get a nice merged array of Downloads & Files at the end to insert into WooCommerce.

So I made a sheet similar to yours.

So the first thing we do is put both the filenames and the URLS into an array. You can name those however you want.

image

In the next step, we iterate over one of the two arrays. I took downloads[] :
image

Next, I aggregate it to a JSON:

image
→ For the file, we get it out of the array URLs[] based on the key.
with data structure:

Then I parse over the array with the Parse JSON module :
image

To end by merging it all into one array again, with an Array Aggregator:

image

This then gives you a nice Array:

image

Which, I think, you’ll be able to map in your WooCommerce downloads section:

Hope that helps!

Thomas - Nola Digital

4 Likes

Oh my God :star_struck:!!

Thank you very very very much Thomas, you are beautiful :laughing:!!!

This is exactly what I need.

Here the result:
Captura de tela 2024-03-27 193050

image

I really appreciate your commitment and dedication in helping me.

A big hug from Brazil :brazil: !!

3 Likes