When retrieving order information from Woocommerce it states it should be an array see..
http://docs.woothemes.com/wc-apidocs/class-WC_Order.html#_get_shipping_address
Instead it returns a comma separated string.
Looking at the function in the core code of Woocommerce...
public function get_shipping_address() {
if ( ! $this->shipping_address ) {
if ( $this->shipping_address_1 ) {
// Formatted Addresses
$address = array(
'address_1' => $this->shipping_address_1,
'address_2' => $this->shipping_address_2,
'city' => $this->shipping_city,
'state' => $this->shipping_state,
'postcode' => $this->shipping_postcode,
'country' => $this->shipping_country
);
$joined_address = array();
foreach ( $address as $part ) {
if ( ! empty( $part ) ) {
$joined_address[] = $part;
}
}
$this->shipping_address = implode( ', ', $joined_address );
}
}
return $this->shipping_address;
}
I can see it using implode to create the string, without modifying this function how can I call this function and retrieve $address as an array? (if this is possible?)
The reason is I CAN explode the returned value but commas in the address will break it.
Habit of answering my own questions...
So to receive a string as explain above you would do it like this...
If you want to receive individual lines you can do so like this...
IMO the later is going to be a lot more useful!