-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable launch your store on trial sites
- Loading branch information
Showing
5 changed files
with
90 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
defined( 'ABSPATH' ) || exit; | ||
|
||
/** | ||
* Class WC_Calypso_Bridge_Admin_Settings | ||
* | ||
* @since x.x.x | ||
* @version x.x.x | ||
* | ||
* Handle Coming Soon mode. | ||
*/ | ||
class WC_Calypso_Bridge_Admin_Settings { | ||
/** | ||
* The single instance of the class. | ||
* | ||
* @var WC_Calypso_Bridge_Admin_Settings | ||
*/ | ||
protected static $instance = null; | ||
|
||
/** | ||
* Get class instance. | ||
* | ||
* @return object Instance. | ||
*/ | ||
final public static function get_instance() { | ||
if ( is_null( self::$instance ) ) { | ||
self::$instance = new self(); | ||
} | ||
|
||
return self::$instance; | ||
} | ||
|
||
/** | ||
* Constructor. | ||
*/ | ||
public function __construct() { | ||
add_filter( 'woocommerce_settings_tabs_array', array( $this, 'replace_settings_tab' ), PHP_INT_MAX ); | ||
} | ||
|
||
/** | ||
* Replace the settings tab. | ||
* | ||
* @param array $tabs The tabs. | ||
* @return array The tabs. | ||
*/ | ||
public function replace_settings_tab( $tabs ) { | ||
global $current_tab; | ||
|
||
if ( wc_calypso_bridge_is_ecommerce_trial_plan() ) { | ||
// Remove Site Visibility setting for the free trial plan. | ||
unset( $tabs['site-visibility'] ); | ||
|
||
if ( isset( $current_tab ) && $current_tab === 'site-visibility' ) { | ||
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings' ) ); | ||
exit; | ||
} | ||
} | ||
|
||
return $tabs; | ||
} | ||
} | ||
|
||
WC_Calypso_Bridge_Admin_Settings::get_instance(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters