How to Sell Limited Availability Products Online with Commerce Hub

Joe from Commerce Hub shows how to use custom objects to sell products with limited supply online. He walks through an example with event tickets, demonstrating how to set up dynamic payment links that adjust based on inventory.
Hey everyone. Joe from the Commerce Hub product team here. And today I'm going to show you how you can sell products with a limited supply online using Commerce Hub and custom objects. So you know, this is applicable for a lot of different use cases, but for me immediately I thought of events with a limited availability and being based in the Miami. And then this here on the right hand side is a custom module as well with a payment link inside of it. And then what I did is I went ahead and built a custom object. So I created a custom object called Countdowns and I have a property on that object called spots left and it's just a number. And then I created a couple different modules, right? These are the modules that we just saw on the webpage. We have this one here which essentially embeds that payment link. And then I have this one here which essentially says, you know, if there are more than zero spots left, you know, it references that custom object. Then we're going to show act now only blank spots remain. And then it dynamically populates this number seven here with the value of spots left on that custom object. And then for this payment link option here, you know when you embed a payment link it's going to be inside of an iframe. So we can't go in there and adjust it directly, but we can easily just hide the iframe. Right? And so what this says is, you know, if it's greater than zero, if there's more than zero spots left, we'll show that payment option. And if there's zero spots left, we're just going to hide that payment option altogether. And so that is pretty much it on the CMS side of things. Now what happens when somebody pays? We need to be able to subtract that number, right? And so to do that I built out a payment based workflow with the payment link source name essentially equal to the internal value of this payment link. And so what happens here is when a successful payment goes through, I actually forgot to put that filter in, but you would want to filter for status is successful, of course, then we're going to have this custom code action run and this is going to essentially get that custom object that Inter Miami tickets record and it's going to decrease the value of spots left by one. And so if somebody pays here and the payment goes through, the next person to load the webpage will see only six spots remain. And so I'm going to go ahead and show you I'm not going to pay right now. You're going to have to take my word for it. But I will go over here to this custom object, and then I'm going to go down to spots left and I'm going to make it zero. I'm going to hit save. Great. So we can see that. And it might take a moment here. You know, this is a little imperfect. You're going to want to work with your developers to make sure that you're not caching like old versions of that property into this web page. But we should see pretty much instantaneously that this website is now no longer showing that payment option. And so it's pretty exciting stuff. I hope you all enjoyed it and let me know if you have any questions. Always feel free to reach out to the commerce team. We're really happy to help. Thanks. Bye. Bye.










