I am using a payment system which does not allow me to make quantity limitation.
So if I want to limit the purchases of a product A to a number X, I can't do it natively.
The website I am using is a WordPress with LeadPages onto it.
I want to be able to store my value X globally and each time a purchase is registered I will decrement X until X = 0 and disable the purchase button.
I thought about creating a DB in WordPress but I am not sure it is the best solution. Because the credentials to access it would be visible on the client side javascript code.
I also saw this solution with JSON Data : REST API - youtube
But again, I am not really sure if it is valid solution.
Thank you for your help on this :-)
I thought about creating a DB in WordPress
Please don't. WordPress already has pretty much everything you would need to manage data, and more.
I want to be able to store my value X globally
Look at WordPress Options API
I want to limit the purchases of a product A to a number X
Assuming the product is a CPT, have a read on custom fields and post_meta
Also, check out the Settings API and pretty much the full developer's handbook of WP because what you are asking is definitely achievable with WordPress. Good luck!