WC_Abstract_Legacy_Order::get_product_from_item
Deprecated since 4.4.0. It is no longer supported and may 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
Returns
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() WC Abstract Legacy Order::get product from item code WC 10.5.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 );
}