Following inline documentation on example shipping module api, I have an implementation of hook_commerce_shipping_services_info(), in which I set callback function for 'rate', 'details_form' etc.

I'm trying to calculate the rate based on the zip code entered by the customer, but the callback for 'rate' only takes two arguments, which are $shipping_services and $order. I dpm both objects, but didn't see any shipping information, entered on the previous page (checkout). The field [commerce_customer_shipping] has Array ( [und] => Array ( [0] => Array ( [profile_id] => 2 ) ) )

How do I get the values for the individual fields, such as address, city, and zip code?

1 Answer 1


See the replacement patterns and give like as below, for example, [commerce-order:commerce-customer-shipping:field-name-line]. Use "-", not "_".


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.