Automattic\WooCommerce\Internal\ShopperLists
ShopperListItem::product_is_live
Whether a resolved product (and its parent, for variations) is publish.
Метод класса: ShopperListItem{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = ShopperListItem::product_is_live( $product ): bool;
- $product(WC_Product) (обязательный)
- Resolved product or variation.
Код ShopperListItem::product_is_live() ShopperListItem::product is live WC 10.9.1
private static function product_is_live( \WC_Product $product ): bool {
if ( ProductStatus::PUBLISH !== $product->get_status() ) {
return false;
}
$parent_id = $product->get_parent_id();
if ( $parent_id > 0 ) {
$parent = wc_get_product( $parent_id );
if ( ! $parent instanceof \WC_Product || ProductStatus::PUBLISH !== $parent->get_status() ) {
return false;
}
}
return true;
}