Is it possible to get shipping address when calculating cost in calculate_quote() ?
Dear All,
I'm working on a Drupal 7 Commerce project with Commerce Shipping, and I have to calculate the shipping cost according to the "Administrative Area" in my own shipping method. I've tried to search a lot of articles but still haven't solved yet, I can NOT get the Shipping Address information in the Calculate_Quote() function.
Any advices?
Thanks a lot in advance!
Comments
Sure would be nice, wouldn't it?
Not seeing an obvious way here, I'm either going to pull out XDebug, my hair, or give up on Commerce ...
If you're still looking, see
If you're still looking, see the appropriate threads on d.o.
Accessing an order's addresses
Here's how I load an order's address info -- it might help you. Might not.
$order = commerce_order_load($orderNumber);
$wrapper = entity_metadata_wrapper('commerce_order', $order);
$billing_address = $wrapper->commerce_customer_billing->commerce_customer_address->value();
$shipping_address = $wrapper->commerce_customer_shipping->commerce_customer_address->value();
Hope this helps,
John McCormick / NEAR DARK
Thank you for posting this.
Thank you for posting this. It is so much better than what I've been doing.