After checking out several times I noticed the customer_profile gets created again even though one was selected from the addressbook, so to solve the shipping information I just made sure the 'copy_billing' value was unset because it was failing this check http://drupalcode.org/project/commerce.git/blob/c36b184701ac0fe6a750d854....

Additionally, to prevent shipping profile getting dups, I crosschecked the address with those stored in the addressbook being the same as the shipping being copied and if so, then use the profile_id and revision_id stored in db.

Comments

artkon’s picture

artkon’s picture

Sorry, I committed file mode changes, here is a good one,

artkon’s picture

Here is a final one, with some comment changes.

googletorp’s picture

Status: Active » Postponed

Good work on the patch, however, the copy billing address functionality is on it's way out of commerce shipping and on it's way into commerce core. So for now will postpone and probably won't do anything if things go as planned.

See #1410022: Improve copy address functionality - create a more generic solution

artkon’s picture

Updated patch: To prevent a PHP notice I inserted an if (!empty($profile_id)) on line 1050 of commerce_shipping.module

Fixed Notice: Undefined variable: profile_id in commerce_shipping_commerce_customer_profile_presave() (line 1050 of /mnt/apci/pdupstore/www/profiles/apci_store/modules/contrib/commerce_shipping/commerce_shipping.module).

artkon’s picture

Previous patch was not applying cleanly, attached is a working patch.

rszrama’s picture

Status: Postponed » Closed (fixed)

Closing this now that the core patch has been committed.

nadavoid’s picture

Updated patch #6 adds condition so that it applies only during checkout. Previously, it was taking effect when editing an existing shipping address.

Also added a @todo in our local site to upgrade to the latest version of commerce, so we won't need this patch at all.

nadavoid’s picture

Updated patch to allow a duplicate to be made if using an address that was used on a previous order. This is done by checking $profile->revision_id.