Compatibility with commerce checkout

Created on 28 February 2020, over 4 years ago
Updated 7 May 2024, 7 months ago

If we have commerce checkout enable for anonymous (New Customers), after submitting registration form, legal module force redirect to /legal_accept and breaks checkout process. Below are the details
1. We should add legal field for commerce checkout registration forms as well. We should alter the this form in legal.module the way we are doing registration form. As interim solution I am using hook_form_alter in custom module to add field in form with $form_id = commerce_checkout_flow_multistep_default

legal_display_fields($form['email_registration_login']['register'], $conditions, 'registration');

2. Since commerce forms follow field-set/panes, we are getting \Drupal::request()->request->get('legal_accept'); as empty in legal_user_insert and instead. As interim solution I am using below solution in custom module ( example_user_insert)

function my_module_user_insert(EntityInterface $entity) {
  $language = \Drupal::languageManager()->getCurrentLanguage();
  $post = \Drupal::request()->request->get('email_registration_login');
  $accepted = $post['register']['legal']['legal_accept'] ? TRUE : FALSE;
  if ($accepted) {
    module_load_include('module', 'legal');
    $conditions = legal_get_conditions($language->getId());
    if (empty($conditions['conditions'])) {
      return;
    }
    legal_save_accept($conditions['version'], $conditions['revision'], $conditions['language'], $entity->get('uid')
      ->getString());
  }
}
🐛 Bug report
Status

Postponed: needs info

Version

3.0

Component

Code

Created by

🇳🇱Netherlands rsingh27

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany Anybody Porta Westfalica

    Is this issue still existing with 2.x? Then the version should be changed to 2.0.x please.

  • Status changed to Postponed: needs info 7 months ago
  • 🇩🇪Germany Anybody Porta Westfalica

    Development happens in 3.x - can this still be reproduced there?

Production build 0.71.5 2024