WC_Order::needs_shipping_address() public WC 1.0
Checks if an order needs display the shipping address, based on shipping method.
{} It's a method of the class: WC_Order{}
Hooks from the method
Return
true/false.
Usage
$WC_Order = new WC_Order(); $WC_Order->needs_shipping_address();
Code of WC_Order::needs_shipping_address() WC Order::needs shipping address WC 5.0.0
public function needs_shipping_address() {
if ( 'no' === get_option( 'woocommerce_calc_shipping' ) ) {
return false;
}
$hide = apply_filters( 'woocommerce_order_hide_shipping_address', array( 'local_pickup' ), $this );
$needs_address = false;
foreach ( $this->get_shipping_methods() as $shipping_method ) {
$shipping_method_id = $shipping_method->get_method_id();
if ( ! in_array( $shipping_method_id, $hide, true ) ) {
$needs_address = true;
break;
}
}
return apply_filters( 'woocommerce_order_needs_shipping_address', $needs_address, $hide, $this );
}