WC_Product_Variation::get_image_id()publicWC 3.0.0

Get main image ID.

Method of the class: WC_Product_Variation{}

Hooks from the method

Return

String.

Usage

$WC_Product_Variation = new WC_Product_Variation();
$WC_Product_Variation->get_image_id( $context );
$context(string)
What the value is for. Valid values are view and edit.
Default: 'view'

Changelog

Since 3.0.0 Introduced.

WC_Product_Variation::get_image_id() code WC 8.7.0

public function get_image_id( $context = 'view' ) {
	$image_id = $this->get_prop( 'image_id', $context );

	if ( 'view' === $context && ! $image_id ) {
		$image_id = apply_filters( $this->get_hook_prefix() . 'image_id', $this->parent_data['image_id'], $this );
	}

	return $image_id;
}