WC_Order_Item_Product::set_variation_id()publicWC 1.0

Set variation ID.

Method of the class: WC_Order_Item_Product{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Order_Item_Product = new WC_Order_Item_Product();
$WC_Order_Item_Product->set_variation_id( $value );
$value(int) (required)
Variation ID.

WC_Order_Item_Product::set_variation_id() code WC 9.4.2

public function set_variation_id( $value ) {
	if ( $value > 0 && 'product_variation' !== get_post_type( $value ) ) {
		$this->error( 'order_item_product_invalid_variation_id', __( 'Invalid variation ID', 'woocommerce' ) );
	}
	$this->set_prop( 'variation_id', absint( $value ) );
}