#vibeman1987_checkout-productdata-unitlabel
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1324424824864374824
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
That doesn't make any sense.
A Product does not have quantity.
Its a logical representation of a good or service
It is only when a Customer purchases one or more instances of that Product that quantity becomes involved
sorry, in the api request to create the checkout session, I'm doing this:
price_data: {
currency: ticket.currency.toLowerCase(),
product_data: {
name: ticket.name,
description: ticket.description || `${ticket.name} - ${combinedData.event_name} @ ${combinedData.name}`,
},
unit_amount: Math.round(ticket.price * 100),
},
I've looked in the API docs, and as far as I know, there is no way to change the "10 Qty" label to something like "10 tickets"
Okay you are still mashing together different concepts.
Wait, so you are trying to get the description to be something different?
No, I'm trying to change the Qty to something more user-friendly
What do you mean by "user-friendly"
You should just be passing line_items={price_data: {...}, quantity: 10}
Let me start from the top, I might have miscommunicated what is happening here.
For my app, I cannot store products in a database, so I have to pull their information from a database (they are event tickets).
When I create a Checkout Session, I set the following information and am then redirected to the URL:
price_data: {
currency: ticket.currency.toLowerCase(),
product_data: {
name: ticket.name,
description: ticket.description,
},
unit_amount: Math.round(ticket.price * 100),
},
quantity: data.tickets[ticket.id],
adjustable_quantity: {
enabled: false
},
The problem (as far as I understand), is that this method does not allow me to create a unit_label the same way that creating a Product would. (example: {"unit_label" : data.tickets[ticket.id] > 1 ? "tickets" : "ticket"})
I want my users to see 10 Tickets instead of Qty 10
Ah, that I don't think you can do with product_data
I can raise a feature request to add that parameter but I cannot guarantee if/when it would get developed. At least we can track your interest in the feature though.
Is that something you would be interested in?
Yes, please!
Feature request filed!