It seems I am able to delete the default Customer Billing Profile field for the Order Entity.
Without it the commerce (checkout) is broken.

Error
The website encountered an unexpected error. Please try again later.

Error message
EntityMetadataWrapperException: Unknown data property commerce_customer_billing. in EntityStructureWrapper->getPropertyInfo() (line 339 of drupal_path/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).

Shouldn't be locked somehow?

Files: 
CommentFileSizeAuthor
#8 Order_Customer_Billing_Profile_locked-1612502-8.patch2.31 KBcvangysel
PASSED: [[SimpleTest]]: [MySQL] 3,570 pass(es).
[ View ]
#6 Order_Customer_Billing_Profile_locked-1612502-6.patch4.77 KBvasike
PASSED: [[SimpleTest]]: [MySQL] 3,567 pass(es).
[ View ]
#1 Order_Customer_Billing_Profile_locked-1612502-1.patch1.17 KBvasike
PASSED: [[SimpleTest]]: [MySQL] 3,567 pass(es).
[ View ]

Comments

Component:Checkout» Order
Status:Active» Needs review
StatusFileSize
new1.17 KB
PASSED: [[SimpleTest]]: [MySQL] 3,567 pass(es).
[ View ]

here is a patch

i don't know if this should be the solution, or it's ok to have this field unlocked and to fix the bug within checkout module.

Version:7.x-1.3» 7.x-1.x-dev
Priority:Critical» Normal
Status:Needs review» Needs work

We actually don't require this on purpose, allowing sites to remove the default billing profile association if they so choose. In that case, I'm guessing checkout was broken for you because you were still showing the billing information checkout pane. If you disable that, it should not provide errors, or if you were to add a different customer profile reference field to your order bundle, then you could update the checkout pane settings to use that field instead.

Perhaps the real fix here to preserve this behavior would be to disable the billing information checkout pane if the customer profile reference field it's been configured to use is removed from the order bundle.

i see,
so where do you think this fix should take place, in which module? checkout or customer?

there's something else:
I delete the Customer Billing field.
I save the 'Billing information' checkout pane with NO Related customer profile reference field
I go the checkout page
Surprise i have the Billing information inputs right in the checkout form.
and The data is saved the Address (commerce_customer_address) field tables.

How it should be the right way?
I' m thinking to have a validation for this Customer checkout pane and disable it if there's no Related customer profile reference field selected.

Sounds like we should also then make sure that pane is not enabled without a valid reference field selected. : D

We can patch both of these issues in the Customer module.

Title:Customer Billing Profile Order field unlockedDisable the Customer Profiles Panes if there are NO Related customer profile reference field
Status:Needs work» Needs review
StatusFileSize
new4.77 KB
PASSED: [[SimpleTest]]: [MySQL] 3,567 pass(es).
[ View ]

here is patch for this (rough stuff).

i found 2 more cases:

  1. The Checkout panes page (Panes ordering)
  2. The customer profile reference fields are deleted BEFORE the Checkout module install.

Assigned:Unassigned» cvangysel

I'll have a look at this.

StatusFileSize
new2.31 KB
PASSED: [[SimpleTest]]: [MySQL] 3,570 pass(es).
[ View ]

I cleaned up the code a bit and removed some of the hacky stuff. The only thing I don't necessarily like about my patch is that the error message when trying to move a customer profile pane that hasn't got a customer profile referenced is a little general.

But then again, when you're deleting entity fields I guess you should know what it is you're doing.

Status:Needs review» Reviewed & tested by the community

Patch looks clean; Confirmed bug (wow!); Applied patch; Bug immediately fixed; Re-installed site and bug is non-existant.

All is well and bug is gone. Love the hook_field_delete_field() ... not sure what it does or why it's necessary.

Assigned:cvangysel» Unassigned
Status:Reviewed & tested by the community» Fixed

Alrighty, in she goes. As for that function, Josh, it basically updates any checkout panes that may have been based on the customer profile reference field to disable them. And agreed w/ Christophe - if you're deleting these fields, you should know what you're doing. No need to go overboard on the error messages. : )

Thanks to vasike for starting this out and the others for driving it home.

Status:Fixed» Closed (fixed)

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