WC_Order::needs_shipping_address()
Checks if an order needs display the shipping address, based on shipping method.
Method of the class: WC_Order{}
Hooks from the method
Return
true|false
.
Usage
$WC_Order = new WC_Order(); $WC_Order->needs_shipping_address();
WC_Order::needs_shipping_address() WC Order::needs shipping address code WC 9.6.1
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 ); }