- Issue created by @grahamC
I want the "shipping same as billing" box to be ticked by default.
The code in alterForm()
suggests that
// Copying is enabled by default for new billing profiles.
_but_ the check that it uses ($shipping_profile->isNew()
) always returns false, as the order (and profile along with it) is saved by ShippingInformation:buildPaneForm()
As a workaround, I have implemented hook_entity_create():
if ($entity->getEntityTypeId() != "profile") {
return;
}
if ($entity->bundle() == "customer") {
$entity->setData('copy_fields', TRUE);
}
This works on this site because the billing profile is a different type. Not sure how to make this generic, as hook_entity_create() cannot see the context of where the profile is being used(?)
Active
1.0
Code