Since #2952529: Support for Layout Builder module is closed I don't think it's child issues will be noticed anymore. So hereby the 2 patches that are still preventing layout builder to work on orders.
Commerce ecosystem:
- Make fields from referenced entities visible on parents (orders should be able to display shipping fields).
- Either through
hook_entity_extra_field_info()(Most modules already have the logic to add the variables during preprocessing, so this hook should suffice in many cases) . See comment #12 for details. - OR by making the whole linked entity available in layout builder, similar to how product variation fields are shown when editing a product
- Either through
Commerce order:
State machine:
Commerce Shipping:
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | Screen Shot 2563-10-09 at 20.07.18.png | 212.08 KB | abx |
| #7 | LayoutBuilder-Enable-With-2Columns-Order-Item.jpg | 75.81 KB | abx |
| #7 | LayoutBuilder-Enable-With-Nothing.jpg | 69.47 KB | abx |
| #5 | LayoutBuilder-Disable.jpg | 158.38 KB | abx |
| #5 | LayoutBuilder-Enable.jpg | 142.04 KB | abx |
Comments
Comment #2
neograph734Comment #3
neograph734Comment #4
abx commentedNot sure I should post in this or that sub issues but I already patched both patches and tested with lastest dev version. It didn't work. I can move around everything in Layout Builder for orders but nothing change when view it.
In order default view, once activated Layout Builder, this information is disappeared.
- Order Items
- "Customer Information" is there but there is nothing in that box.
- "Placed"
- "Changed"
- "Validate Order" Button
- "Cancel Order" Button
Also when, patch "State Machine", I got warning :
Comment #5
abx commentedComment #6
neograph734abx that would make sense. The default order template does never render the entire order, only its individual fields.
Could you try changing
commerce/modules/order/templates/commerce-order--admin.html.twig(assuming you are working on the admin view mode) and place{{ order }}somewhere in that template? That should render the order with layout builder enabled.I suppose we need to find a way to make the fields layout use that template, but have layout builder use the commerce-order.html.twig template instead.
Comment #7
abx commentedNeograph734,
I tried to put
{{ order }}in thecommerce/modules/order/templates/commerce-order--admin.html.twigI, then, removed everything inside "Layout Builder" and found that the information that appear at first is there and has 2 copies of them. (image attached.)I, then, tried to add "Order Items" in 2 Column layout in Layout Builder. Both of them appear. (Image attached.)
Comment #8
abx commentedComment #9
abx commentedI can't delete image that I uploaded though.
Just play around with Layout Builder and what I noticed that some options are not available in Layout Builder. (All the information that show twice in the image and some others.)
These are what I don't see in the option list.
- Order Activity
- Shipping Information
- Shipping Method
- Subtotal
- Shipping Fee
- Validate Order Button
- Cancel Order Button
- Unit Price, Quantity and Total Price
Comment #10
neograph734To give you the best control, I think you should change the twig template to only contain {{ order }}. The reason you see double fields is because of the item being rendered as part of {{order}} but also individually as {{order.field_name}}.
I'll have a look at the fields you're missing later this week. It could be a known issue in core. Could you try disabling layout builder, then place the missing fields into the enabled section and then turn layout builder back on. Do they show then?
Comment #11
abx commentedI play around with it for a bit and got an update for missing fields below:
MissingMissingMissing1 - 3 are fields that always display when enable Layout Builder and I couldn't find any option in Both with/without Layout builder. (Attached image with normal field list without Layout builder.)
Comment #12
neograph734Thanks abx, for taking the time to look around and pinpoint the missing items.
I've played around and got the shipping information to show (with 2 profiles though... ?) by using the following hook in commerce_shipping:
For commerce activity, not tested, but simply looking at
commerce_log_preprocess_commerce_orderI'd assume the exact same hook should work:Though I've also seen how fields from linked entities can be shown in the layout builder. (eg. product variation field when editing a product.). I just have no idea about the complexity of that.
Updated the issue summary with both options.
Comment #13
neograph734Comment #14
neograph734Comment #15
neograph734Comment #16
neograph734