WordPress at Your Fingertips
function is not described

WC_REST_Products_V1_Controller::update_post_meta_fields() protected WC 1.0

Update post meta fields.

{} It's a method of the class: WC_REST_Products_V1_Controller{}

No Hooks.

Return

true|false|WP_Error.

Usage

// protected - for code of main (parent) or child class
$result = $this->update_post_meta_fields( $post, $request );
$post(WP_Post) (required)
Post data.
$request(WP_REST_Request) (required)
Request data.

Code of WC_REST_Products_V1_Controller::update_post_meta_fields() WC 5.5.2

<?php
protected function update_post_meta_fields( $post, $request ) {
	$product = wc_get_product( $post );

	// Check for featured/gallery images, upload it and set it.
	if ( isset( $request['images'] ) ) {
		$product = $this->set_product_images( $product, $request['images'] );
	}

	// Save product meta fields.
	$product = $this->set_product_meta( $product, $request );

	// Save the product data.
	$product->save();

	// Save variations.
	if ( $product->is_type( 'variable' ) ) {
		if ( isset( $request['variations'] ) && is_array( $request['variations'] ) ) {
			$this->save_variations_data( $product, $request );
		}
	}

	// Clear caches here so in sync with any new variations/children.
	wc_delete_product_transients( $product->get_id() );
	wp_cache_delete( 'product-' . $product->get_id(), 'products' );

	return true;
}