WordPress at Your Fingertips
function is not described

WC_Product_Grouped_Data_Store_CPT::update_post_meta() protected WC 3.0.0

Helper method that updates all the post meta for a grouped product.

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

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->update_post_meta( $product, $force );
$product(WC_Product) (required) (passed by reference — &)
Product object.
$force(true|false)
Force update. Used during create.
Default: false

Changelog

Since 3.0.0 Introduced.

Code of WC_Product_Grouped_Data_Store_CPT::update_post_meta() WC 5.8.0

protected function update_post_meta( &$product, $force = false ) {
	$meta_key_to_props = array(
		'_children' => 'children',
	);

	$props_to_update = $force ? $meta_key_to_props : $this->get_props_to_update( $product, $meta_key_to_props );

	foreach ( $props_to_update as $meta_key => $prop ) {
		$value   = $product->{"get_$prop"}( 'edit' );
		$updated = update_post_meta( $product->get_id(), $meta_key, $value );
		if ( $updated ) {
			$this->updated_props[] = $prop;
		}
	}

	parent::update_post_meta( $product, $force );
}