WC_Order_Item_Product::get_product()publicWC 1.0

Get the associated product.

Method of the class: WC_Order_Item_Product{}

Return

WC_Product|true|false.

Usage

$WC_Order_Item_Product = new WC_Order_Item_Product();
$WC_Order_Item_Product->get_product();

WC_Order_Item_Product::get_product() code WC 9.4.2

public function get_product() {
	if ( $this->get_variation_id() ) {
		$product = wc_get_product( $this->get_variation_id() );
	} else {
		$product = wc_get_product( $this->get_product_id() );
	}

	// Backwards compatible filter from WC_Order::get_product_from_item().
	if ( has_filter( 'woocommerce_get_product_from_item' ) ) {
		$product = apply_filters( 'woocommerce_get_product_from_item', $product, $this, $this->get_order() );
	}

	return apply_filters( 'woocommerce_order_item_product', $product, $this );
}