Merge pull request #14460 from woocommerce/add/has_shipping_address
Added has_shipping_address helper method
This commit is contained in:
commit
9c33d9bbf3
|
@ -813,13 +813,23 @@ class WC_Order extends WC_Abstract_Order {
|
|||
* @return string
|
||||
*/
|
||||
public function get_formatted_shipping_address() {
|
||||
if ( $this->get_shipping_address_1() || $this->get_shipping_address_2() ) {
|
||||
if ( $this->has_shipping_address() ) {
|
||||
return WC()->countries->get_formatted_address( apply_filters( 'woocommerce_order_formatted_shipping_address', $this->get_address( 'shipping' ), $this ) );
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the order has a shipping address.
|
||||
*
|
||||
* @since 3.0.4
|
||||
* @return boolean
|
||||
*/
|
||||
public function has_shipping_address() {
|
||||
return $this->get_shipping_address_1() || $this->get_shipping_address_2();
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Setters
|
||||
|
|
Loading…
Reference in New Issue