WC_Abstract_Legacy_Order::get_product_from_item()publicWC 1.0

Deprecated from version 4.4.0. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Get a product (either product or variation).

Method of the class: WC_Abstract_Legacy_Order{}

Hooks from the method

Return

WC_Product|true|false.

Usage

$WC_Abstract_Legacy_Order = new WC_Abstract_Legacy_Order();
$WC_Abstract_Legacy_Order->get_product_from_item( $item );
$item(object) (required)
-

Changelog

Deprecated since 4.4.0

WC_Abstract_Legacy_Order::get_product_from_item() code WC 8.9.0

public function get_product_from_item( $item ) {
	wc_deprecated_function( 'WC_Abstract_Legacy_Order::get_product_from_item', '4.4.0', '$item->get_product()' );
	if ( is_callable( array( $item, 'get_product' ) ) ) {
		$product = $item->get_product();
	} else {
		$product = false;
	}
	return apply_filters( 'woocommerce_get_product_from_item', $product, $item, $this );
}