1

For Anonymous users, the My Shipping information is the same as my Billing information checkbox doesn't reload the Shipping Information checkout pane.

I have the checkbox working for authenticated users, but when an anonymous user is going through checkout, the ajax callback never fires. The #element_validate function 'commerce_customer_profile_copy_validate' is never called. The #ajax['callback'] => 'commerce_customer_profile_copy_refresh' is never called.

Watching the network tab in Chrome, the ajax request is never fired.

The checkbox is checked by default and nothing happens when I un-check it. The Shipping Information pane doesn't expand and show the shipping information form fields via ajax.

Is there some permission I'm missing that would allow anonymous users to use this checkbox?

1
  • it certainly sounds like a permission issue but AFAIK there isn't any permission attached to AJAX. Have you tried emptying cache and rebuilding permissions to flush the error out? Commented Apr 22, 2015 at 16:37

1 Answer 1

0

Turns out I was kicking myself on this one. I forgot I had some custom hook_js_alter code in my template.php that removes unnecessary js from the page for anonymous users. This was done to improve site speed and because my custom theme didn't require these default Drupal js libraries.

function theme_js_alter(&$javascript) {
  $logged_in_user = user_uid_optional_load();
  if(!in_array("authenticated user", $logged_in_user->roles)) {
    foreach($javascript as $key => $value) {
      unset($javascript[$key]);
    }
  }
}

However I do need these javascripts on commerce checkout pages apparently, so I added a request_path() check for checkout and cart pages so the js would not be unset.

I confirmed the My Shipping information is the same as my Billing information checkbox now works for anonymous users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.