WC_Order_Item_Product::get_product()

Get the associated product.


Description Description


Return Return

(WC_Product|bool)


Top ↑

Source Source

File: includes/class-wc-order-item-product.php

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


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.