Fixed how to delete meta data on REST API v2
This commit is contained in:
parent
1783953f15
commit
f289d0e05c
|
@ -597,8 +597,9 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller {
|
|||
protected function maybe_set_item_meta_data( $item, $posted ) {
|
||||
if ( ! empty( $posted['meta_data'] ) && is_array( $posted['meta_data'] ) ) {
|
||||
foreach ( $posted['meta_data'] as $meta ) {
|
||||
if ( isset( $meta['key'], $meta['value'] ) ) {
|
||||
$item->update_meta_data( $meta['key'], $meta['value'], isset( $meta['id'] ) ? $meta['id'] : '' );
|
||||
if ( isset( $meta['key'] ) ) {
|
||||
$value = isset( $meta['value'] ) ? $meta['value'] : null;
|
||||
$item->update_meta_data( $meta['key'], $value, isset( $meta['id'] ) ? $meta['id'] : '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue