Improve check for unlimited stock (updated #31486)