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());
}
}
Postponed: needs info
3.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.