How should I make a stocks system that resets daily?

I saw this tutorial: How to Make Server-Synced Daily Shops

And I want to make a system for my game, where there’s a merchant that sells items. But each item has a specific amount that you can buy before it’s no longer in stock. Does anyone know how I can do this? Thanks for your help.

If each item has a specific amount of stocks, you could probably use database to save those stocks and update it whenever its bought so across the servers it’ll be updated with the current stock value, or maybe even messaging service

What I’m struggling with is how to make sure each server syncs correctly with the amount of stocks left. I don’t understand how I’d be able to make sure that if there’s 50 of something left then 50 people get it and no extras.