true, 'wpcom_product_slug' => static::get_wpcom_product_slug(), ), Wpcom_Products::get_product_pricing( static::get_wpcom_product_slug() ) ); } /** * Get the WPCOM product slug used to make the purchase * * @return string */ public static function get_wpcom_product_slug() { return 'jetpack_social_basic_yearly'; } /** * Checks whether the current plan (or purchases) of the site already supports the product * * @return boolean */ public static function has_required_plan() { $purchases_data = Wpcom_Products::get_site_current_purchases(); if ( is_wp_error( $purchases_data ) ) { return false; } if ( is_array( $purchases_data ) && ! empty( $purchases_data ) ) { foreach ( $purchases_data as $purchase ) { // Social is available as standalone bundle and as part of the Complete plan. if ( strpos( $purchase->product_slug, 'jetpack_social' ) !== false || str_starts_with( $purchase->product_slug, 'jetpack_complete' ) ) { return true; } } } return false; } /** * Get the URL where the user manages the product. * * If the standalone plugin is active, * it will redirect to the standalone plugin settings page. * Otherwise, it will redirect to the Jetpack settings page. * * @return string */ public static function get_manage_url() { if ( static::is_standalone_plugin_active() ) { return admin_url( 'admin.php?page=jetpack-social' ); } return admin_url( 'admin.php?page=jetpack#/settings?term=publicize' ); } }