WC_REST_Customers_V2_Controller::update_customer_meta_fields()
Update customer meta fields.
Method of the class: WC_REST_Customers_V2_Controller{}
No Hooks.
Return
null
. Nothing.
Usage
// protected - for code of main (parent) or child class $result = $this->update_customer_meta_fields( $customer, $request );
- $customer(WC_Customer) (required)
- Customer data.
- $request(WP_REST_Request) (required)
- Request data.
WC_REST_Customers_V2_Controller::update_customer_meta_fields() WC REST Customers V2 Controller::update customer meta fields code WC 7.7.0
protected function update_customer_meta_fields( $customer, $request ) { parent::update_customer_meta_fields( $customer, $request ); // Meta data. if ( isset( $request['meta_data'] ) ) { if ( is_array( $request['meta_data'] ) ) { foreach ( $request['meta_data'] as $meta ) { $customer->update_meta_data( $meta['key'], $meta['value'], isset( $meta['id'] ) ? $meta['id'] : '' ); } } } }