I’ve looked into the admin preparePage() function but I’m not skilled enough to use it for my purpose (and it updates the whole page, I just need to update a specific custom page header)
I have a collection of pages representing an item reference. I’d like to put a quantity custom field in the header and be able to update it from an admin page that lists all the items (pages) and let the user to modify the quantity.
May I suggest an idea: do not put the quantity custom field in the header but save them in a data file.
Since each page has a slug, you may take inspiration from Star Ratings plugin. This plugin allows users to choose how much pleasure give to a post and records it in two files in the /user/data/star-ratings/ ips.json includes users IP, stars.json contains routes and satisfaction.
Users increase the amount that can be managed in admin