Automattic\WooCommerce\Internal\ShopperLists
ShopperListItem::product_is_live
Whether a resolved product (and its parent, for variations) is publish.
Method of the class: ShopperListItem{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = ShopperListItem::product_is_live( $product ): bool;
- $product(WC_Product) (required)
- Resolved product or variation.
ShopperListItem::product_is_live() ShopperListItem::product is live code 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;
}