It is possible to change the file name of an uploaded file during the upload in WP, you can do a search for this and find several solutions, however, it’s not possible to do what you’re looking for. The reason is that the field with the stock number won’t be available until after the image is already uploaded and saved to the uploads folder. When you add an image in ACF the image is uploaded and then then actual value of the field is the image ID that was uploaded.
Giving this some thought, you could rename the file after the upload once the post is submitted. Well, not really rename it exactly, more like replace it. You could create an acf/save_post filter and in this filter
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.