Skip to content

Commit

Permalink
Fix Social CTA on My Jetpack (#34895)
Browse files Browse the repository at this point in the history
* Add has_required_plan for Social

* changelog

* Fix wpcom product slug for Social

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/7452867699
  • Loading branch information
IanRamosC authored and matticbot committed Jan 8, 2024
1 parent e4388f5 commit e9ea4fa
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/products/class-social.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,28 @@ public static function get_pricing_for_ui() {
* @return string
*/
public static function get_wpcom_product_slug() {
return 'jetpack_social';
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;
}

/**
Expand Down

0 comments on commit e9ea4fa

Please sign in to comment.