Website Selector Advanced Question

Hey there. I've been using the new Website Selector where you can fetch the information from any tab and it's an absolute game-changer! It's the best feature you guys could have added.

That being said, I do have a couple of questions.

For example, in the example below, I am using it to get the name of the product we sell from the order page. It's working fine, but it only takes the first product.

How can I make it so that it fetches the name of all of the products?

For example, if there is just one product, it will say:
Product 1

If there is 2, it will say:
Product 1 and Product 2

If there is more, it will separate the first ones by comma, and then add the "and" just for that last one:
Product 1, Product 2, Product 3 and Product 4

This is the class for the product name: wc-order-item-name

And this is the current code I have (which works fine for just one product):

{site: text; page=https://secure.goodnesslover.com/wp-admin/*; select=ifneeded; selector=.wc-order-item-name; trim=yes}

All of the product names have the same class.

2023-11-30 21 51 51

Once I have this resolved, I'd like to do the exact same for Shopify, but hopefully the solution for this will also work there.

Thank you in advance!

Daniel

Hi @Support_Goodness_Lov thanks for another interesting question :slightly_smiling_face: We released this in June: June Development Update so now is a good time to revisit it.

First of all, because you want multiple matches, enable multiple setting on the website text command. See screenshot below:

image

Then, use the "Select from website" button. Note that this will now highlight multiple matches on the target webpages. You can hold Shift key on your keyboard, and then click to toggle parts of the webpage (to include them or remove them). You will see the same guiding text in the popper:

image

After you create your desired selection, you will get a list output like this: ["Product 1", "Product 2", "Product 3"]. To create your desired string output, you need to do this:

Replace the site command with your site command:
{=join({site: text; selector=...; multiple=yes}, "BLAZE_AND")}

As an example, this is how it will appear:
{=join(["Product 1", "Product 2", "Product 3"], "BLAZE_AND")}


Given your specific information, I think this will work for you:

{=join({site: text; page=https://secure.goodnesslover.com/wp-admin/*; select=ifneeded; selector=.wc-order-item-name; multiple=yes; trim=yes}, "BLAZE_AND")}

But I still mentioned all steps above for you in case it doesn't work for you

Let me know if it works for you! :smiley:

Thank you Gaurang. This worked perfectly. I had to make some slight modifications for Shopify but got it to work there too!

As always, thank you for your amazing support! :blush:

1 Like