Note that the Quantity field is visible in the Edit popup, but not in the Add popup.
The approach requires using a FormTemplate, in which you can check whether the popup is for adding a new record or for editing an existing record. This information is available in the template through the context: formContext.IsNew
Then you can add conditional logic to the template, so that the respective field shows only in the Edit popup and remains hidden in the Add popup.