Handling two dynamic values in a dropdown menu

Okay. I am using API connector to link to Shopify. I am implementing “Buy Now” buttons in my bubble app. The button takes you directly to the Shopify Cart/checkout page as follows: https://website.shopify.com/cart/VARIANT_ID#:QUANTITY

My dynamic expression to achieve this is:

https://website.shopify.com/cart/Dropdown1’s Value:Dropdown2’s Value

This works fine, the problem is the Variant ID, which is what I need for my BUY NOW button (link to Shopify), is not customer friendly. So I need the dropdown menu to display Variant’s Title, but be able to dynamically use the Variant’s ID behind the scenes. I’m hoping there’s some way to utilize the captions option (which I don’t understand) or some way to manipulate or link the data behind the scenes, maybe in my workflow (creating a thing which includes both title and variant ID#, for instance? if so…help!).

I hope this is clear, but if not, let me know and I can elaborate. Thanks ahead of time.

Hi! I’m may help you, but I didn’t fully understand, can you elaborate a little more please? maybe a screenshot would be useful as well :slight_smile:

If this doesn’t help, I’ll get screenshots (just not at my computer currently). I’m going to give a basic example.

I sell a t-shirt on shopify. I give the customer a dropdown menu to choose between S, M, and Large sizes. Shopify treats each one as a variant with a unique ID# like 0942758094385092. In order to populate the shopping cart, I need the app to send the customer back to shopify with a link like: mysite.shopify.com/cart/0942758094385092.

But obviously I don’t want my customer’s dropdown menu to look like this:

Choose a size:
0942758094385092
0942758094385093
0942758094385094

I want it to look like this:

Choose a size:
Small
Medium
Large

But then I need the app to know if the customer picks Small, to use the variant ID that belongs to that shirt in a small size to populate the cart.

I feel like the answer is probably in the workflow, through the use of a “thing” but I’m not sure how to go about doing it. Help?

got it, yeah, what you can do is create and object named “productSize” with fields “size” and “unique id” (this is the id that will be send to shopify). I assume you have a “product” object, in it you will create a new field of type “productSize” who will be a list.

That way you will be able to display in the dropdown the sizes of that product, for example: “Current page product’s list of productSize’s size” That will display in the dropdown the sizes of that product i.e. small, medium, large, extra-large, and so on.

When clicking on the button that will send them to shopify you simply send in the url the value “dropdown value’s uniqueid”

i.e. mysite.shopify.com/cart/ dropdown value’s uniqueid

Hope it helps :slight_smile:

Rodrigo from https://bluflame.xyz

Very helpful. Final thing here, and ultimately (I think) what I’m struggling with:

How do I get the information from API Connector (Shopify) into the ‘Thing’ dynamically, since products are regularly being added/taken off etc?

Thanks,

do you have already all your Get calls for shopify in the api connector?

Yes I sure do, and I’ve got everything except variants working great.

I should say I was not using ‘things’ I was just calling from the api, so haven’t figured out putting info from my api calls into things.

depending of what you are retrieving from the API is how you can use it in your app, to get the information via a Get call, in dynamic data of your element you need to select “Get data from external API” and select the Get call in question. If you are getting a product, probably it contains an array of sizes or something like that that you can display in a dropdown.

In the dropdown you will pull in the values from your API, and use the “friendly” field in the Option.

drop1

Then you can refer to the drop down and pull in the data for the field you want.

In this example I am showing a Google Places Name, and returning the Address. But it will work exactly the same.

You are a superstar. Thank you and I’ve got it working.