How to limit the purchase quantity of a particular SKU with script editor

Does anybody know how to limit the purchased quantity of a particular SKU of a certain item as we only have limited stock and is an exclusive product? I have heard script editor is able to do this, if anybody can help?

Thank you

There’s an example in the docs. Did you spot that or is it not what you’re looking for? Perhaps it’s just the changing of that code from all products to something very specific that you’re getting on.

https://help.shopify.com/en/manual/checkout-settings/script-editor/examples/line-item-scripts#limit-product-quantities