Needs review
Project:
Commerce Shipping
Version:
3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 May 2026 at 17:40 UTC
Updated:
15 May 2026 at 15:34 UTC
Jump to comment: Most recent
In 3.x, a new shipping information card is added on the order view page, which allows editing shipment via a modal form, and it is not possible to add any other fields to this form except the predefined ones. The only way to do that is to override the form class.
Add a custom field to any shipment type
Try to add this custom field to the edit modal form
Define a new hook that will allow to add more components to the form and call it in the ShipmentEditModalForm
Create a new form mode to manage fields on the edit form
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
tbkot commentedComment #4
jsacksick commentedThe hook or overriding the form class would both require writing code... We don't really define hooks anywhere else... So not sure that is really useful? What's the problem with extending the form class?
Maybe we're just missing a protected helper that can be overridden from a child class. The main difference ofc is that wouldn't be an official API.
Also, I can't remember off the top of my head why we didn't simply use a form mode here?
Comment #5
tbkot commentedComment #6
tbkot commentedNow it should use a new form display if it is configured. Otherwise, the behavior of this form remains the same (only required fields are shown).