ACF\Pro\Meta

WooOrder::update_metapublicACF 6.4

Updates an object ID with the provided meta array.

Method of the class: WooOrder{}

No Hooks.

Returns

null. Nothing (null).

Usage

$WooOrder = new WooOrder();
$WooOrder->update_meta( $object_id, $meta );
$object_id(int|string)
The ID of the object the metadata is for.
$meta(array)
The metadata to save to the object.
Default: array()

Changelog

Since 6.4 Introduced.

WooOrder::update_meta() code ACF 6.8.8

public function update_meta( $object_id = 0, array $meta = array() ) {
	$order = wc_get_order( $object_id );

	if ( ! $order ) {
		return;
	}

	foreach ( $meta as $name => $value ) {
		$value = wp_unslash( $value );
		$order->update_meta_data( $name, $value );
	}

	$order->save();
}