WordPress at Your Fingertips
function is not described

WC_Order_Item_Product::set_product_id() public WC 1.0

Set Product ID

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

No Hooks.

Return

null. Nothing.

Usage

$WC_Order_Item_Product = new WC_Order_Item_Product();
$WC_Order_Item_Product->set_product_id( $value );
$value(int) (required)
Product ID.

Code of WC_Order_Item_Product::set_product_id() WC 5.7.1

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 ) );
}