WordPress at Your Fingertips
function is not described

WC_Abstract_Legacy_Order::get_product_from_item() public WC 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).

{} It's a 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 4.4.0

Code of WC_Abstract_Legacy_Order::get_product_from_item() WC 5.7.1

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