Automattic\WooCommerce\Internal\StockNotifications\Utilities
EligibilityService::product_allows_signups
Check if a product allows signups.
Method of the class: EligibilityService{}
No Hooks.
Returns
true|false. True if the product allows signups, false otherwise.
Usage
$EligibilityService = new EligibilityService(); $EligibilityService->product_allows_signups( $product ): bool;
- $product(WC_Product) (required)
- The product to check.
EligibilityService::product_allows_signups() EligibilityService::product allows signups code WC 10.3.6
public function product_allows_signups( WC_Product $product ): bool {
if ( $product->is_type( ProductType::VARIATION ) ) {
$parent_product = wc_get_product( $product->get_parent_id() );
if ( ! $parent_product instanceof WC_Product ) {
return false;
}
return $this->product_allows_signups( $parent_product );
}
return 'no' !== $product->get_meta( Config::get_product_signups_meta_key() );
}