I am using Field Groups to organize the display of several questions I added to the Customer Profile. I have it set up in the manage form display tab and the manage display tab.

The /review page, the /orders pages, and the email receipt all show the questions properly grouped, which is great. But, the /order_information page does not group them. Is this a bug or normal that the fields are not grouped on the order_information page?

Issue fork commerce-3059187

Command icon Show commands

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

J. created an issue. See original summary.

bojanz’s picture

We don't claim any field_group compatibility. Guessing either Commerce or Profile will need to be patched to support it.

vasyok’s picture

Ok, what do you suggest for grouping fields on order_information pages?

j.’s picture

Any hints on what needs patched to accomplish this? Our order form requires asking several non-standard shipping/billing questions. The ability to present these questions together in smaller groups makes the form more usable/readable.

finne’s picture

In Commerce Products there is this code which provides fieldgroup compatibility:

/**
 * Implements hook_field_group_content_element_keys_alter().
 *
 * Allow products to render fields groups defined from Fields UI.
 */
function commerce_product_field_group_content_element_keys_alter(&$keys) {
  $keys['commerce_product'] = 'product';
  $keys['commerce_product_variation'] = 'product_variation';
}

I need field groups also in the display of Orders, so I propose we also add this to the order module:

/**
 * Implements hook_field_group_content_element_keys_alter().
 *
 * Allow products to render fields groups defined from Fields UI.
 */
function commerce_order_field_group_content_element_keys_alter(&$keys) {
  $keys['commerce_order'] = 'order';
  $keys['commerce_order_item'] = 'order_item';
}

finne’s picture

Sorry, I'm not fluent in the gitlab fork and merge requests yet :-)

Here is a patch that copies the product fieldgroup code to the order module.

jsacksick’s picture

@finne: Does this fix the issue? If so, I'm inclined to commit the patch.

finne’s picture

Yes, this patch is working on my D8 / D9 Commerce 2 installs and allows me to use fieldgroups in the Order Field display settings.

  • jsacksick committed 04d7c67 on 8.x-2.x authored by finne
    Issue #3059187 by finne: Support the Field group module for orders.
    

  • jsacksick committed 899baa5 on 3.0.x authored by finne
    Issue #3059187 by finne: Support the Field group module for orders.
    
jsacksick’s picture

Status: Active » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.