switch themes after inventory change

looking for a way to switch themes after a specific product has been sold out. i didn’t see a way to do that with Flow. not sure if it’s possible with Script, either. we are offering a free gift but once it’s sold out, we want the home hero section and announcement to switch back to business as usual.

I believe you can do that via a cloud function - you trigger a product update, check if the product matches and if it’s out of stock, you can check this API to switch theme as needed.