I think that your app would actually be best as a purely client-side application, not requiring PHP at all. I would love to create it in Elm, a powerful web scripting language that transpiles to highly compatible and blazing fast JavaScript. Once built, the entire application would be a cacheable, static asset on your servers, while giving users a dynamic, interactive experience. Creating save codes would be a simple addition.
Elm has the additional advantage over traditional scripting languages of supporting Algebraic Data Types, which would ensure that your users never see an impossible combination of ingredients or amounts.
It would be fully integrable with WooCommerce/WordPress, and safe from conflicts with other modules, plugins or scripts.