0

My site uses 2 custom profile types for a particular set of customers. For these, I have the default billing and shipping profile panes completely removed on the order edit screen via Customer Profile Type UI, yet any edit to an order (manual or programmatic) still re-adds them to the profile on save (resulting in 4 profiles for the order).

The address field has been identified as the culprit, but in my case, the default profile panes are not present in the form, so I don't understand how an address field that isn't there could trigger a new profile being added. Is there another mechanism in Commerce that would add default profiles if they are missing?

1 Answer 1

0

I think the typical issue is that because the address field value includes a country code by default, it's always assumed to have data ... so my guess is that whatever mechanism the Customer Profile Type UI is using to disable those sections of the order edit form isn't actually unsetting or otherwise removing them from the forms themselves. I don't have experience with the module in question, but if you have the ability, you'd likely be better off writing your own form alter to disable those portions of the edit form.

2
  • I appreciate it, Ryan. I've seen those situations and it makes sense, however in my scenario I've verified that the fields are definitely unset. The basic flow of the issue is: 1. Edit an order with no default profiles associated (and fields not present in form). 2. Save changes. 3. Edit same order again, empty default profiles are now present. Any chance you could point me to the function that adds the profiles in the first place? Then I should be able to write a form_alter to make sure they don't come back. Thanks!
    – CorPaige
    Commented Mar 9, 2020 at 17:35
  • Hmm, thanks for the extra info. I'll see if I can reproduce the issue, but I'm driving home from a Drupal Association retreat with a lot to catch up on from work when I get back ... no promises on timing unfortunately. :-/ Commented Mar 10, 2020 at 22:37

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.