', esc_url( SUBSCRPT_ASSETS . '/images/icons/subscription-20.png' ), esc_attr( $label ) ); } /** * Whether a product is sold as a subscription. * * Simple products check the product itself; variable products count when * any variation is subscription-enabled (a plan tied to the parent applies * to every variation, so it is picked up there). * * @param \WC_Product $product Product. * * @return bool */ public static function is_subscription_product( $product ) { $product_id = $product->get_id(); if ( ! $product->is_type( 'variable' ) ) { return subscrpt_is_subscription_enabled( $product_id ); } foreach ( $product->get_children() as $variation_id ) { if ( subscrpt_is_subscription_enabled( $product_id, $variation_id ) ) { return true; } } return false; } /** * Icon styles, on the products list screen only. * * @return void */ public function enqueue_styles() { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; if ( ! $screen || 'edit-product' !== $screen->id ) { return; } wp_register_style( 'subscrpt_product_list', false, array(), SUBSCRPT_VERSION ); wp_enqueue_style( 'subscrpt_product_list' ); wp_add_inline_style( 'subscrpt_product_list', '.subscrpt-product-list-icon{margin-left:6px;vertical-align:middle;}' ); } }