WC_Order_Item_Product::set_product_id()publicWC 1.0

Set Product 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_product_id( $value );
$value(int) (required)
Product ID.

WC_Order_Item_Product::set_product_id() code WC 9.4.2

public function set_product_id( $value ) {
	if ( $value > 0 && 'product' !== get_post_type( absint( $value ) ) ) {
		$this->error( 'order_item_product_invalid_product_id', __( 'Invalid product ID', 'woocommerce' ) );
	}
	$this->set_prop( 'product_id', absint( $value ) );
}