WC_Order_Item_Product::get_product
Get the associated product.
Method of the class: WC_Order_Item_Product{}
Hooks from the method
Returns
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() WC Order Item Product::get product code WC 10.6.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 );
}