WC_REST_Orders_V2_Controller::update_address
Update address.
Method of the class: WC_REST_Orders_V2_Controller{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->update_address( $order, $posted, $type );
- $order(WC_Order) (required)
- Order data.
- $posted(array) (required)
- Posted data.
- $type(string)
- Type of address; 'billing' or 'shipping'.
Default: 'billing'
WC_REST_Orders_V2_Controller::update_address() WC REST Orders V2 Controller::update address code WC 10.3.6
protected function update_address( $order, $posted, $type = 'billing' ) {
foreach ( $posted as $key => $value ) {
if ( is_callable( array( $order, "set_{$type}_{$key}" ) ) ) {
$order->{"set_{$type}_{$key}"}( $value );
}
}
}