Automattic\WooCommerce\Internal\ShopperLists

ShopperListItem::get_productpublicWC 1.0

Resolve the live product (or variation) backing this saved item.

Метод класса: ShopperListItem{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ShopperListItem = new ShopperListItem();
$ShopperListItem->get_product(): ?\WC_Product;

Код ShopperListItem::get_product() WC 10.9.1

public function get_product(): ?\WC_Product {
	if ( $this->product instanceof \WC_Product ) {
		return $this->product;
	}
	$id            = $this->variation_id > 0 ? $this->variation_id : $this->product_id;
	$product       = $id > 0 ? wc_get_product( $id ) : false;
	$this->product = $product instanceof \WC_Product ? $product : null;
	return $this->product;
}