Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark customize store task complete when user redirects to the site ed… #1307

Merged
merged 7 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions class-wc-calypso-bridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public function includes() {
require_once WC_CALYPSO_BRIDGE_PLUGIN_PATH . '/includes/class-wc-calypso-bridge-product-import-fix.php';
require_once WC_CALYPSO_BRIDGE_PLUGIN_PATH . '/includes/class-wc-calypso-bridge-skip-obw.php';
require_once WC_CALYPSO_BRIDGE_PLUGIN_PATH . '/includes/class-wc-calypso-bridge-footer-credits.php';
require_once WC_CALYPSO_BRIDGE_PLUGIN_PATH . '/includes/class-wc-calypso-bridge-customize-store.php';

// Experiments.
require_once WC_CALYPSO_BRIDGE_PLUGIN_PATH . '/includes/experiments/class-wc-calypso-bridge-task-list-reminderbar-experiment.php';
Expand Down
60 changes: 60 additions & 0 deletions includes/class-wc-calypso-bridge-customize-store.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* Adds Customize Store task related functionalities
*
* @package WC_Calypso_Bridge/Classes
* @since 1.0.0
* @version 2.2.14
*/

defined( 'ABSPATH' ) || exit;

/**
* WC Calypso Bridge Customize Store
*/
class WC_Calypso_Bridge_Customize_Store {

/**
* Class instance.
*
* @var WC_Calypso_Bridge_Customize_Store instance
*/
protected static $instance = false;

/**
* Get class instance
*/
public static function get_instance() {
if ( ! self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}

/**
* Constructor.
*/
private function __construct() {
add_action( 'plugins_loaded', function() {
if ( class_exists( '\Automattic\WooCommerce\Admin\Features\Features' ) && \Automattic\WooCommerce\Admin\Features\Features::is_enabled( 'customize-store' ) ) {
add_action( 'load-site-editor.php', array( $this, 'mark_customize_store_task_as_completed_on_site_editor' ) );
}
});
}

/**
* Mark Customize Store task as completed on Site Editor by checking $_GET['from'] value.
* The value is set from WP-Calypso.
*
* @since 2.2.14
*
* @return void
*/
public function mark_customize_store_task_as_completed_on_site_editor() {
if ( isset( $_GET['from'] ) && $_GET['from'] === 'theme-info' ) {
update_option( 'woocommerce_admin_customize_store_completed', 'yes' );
}
}
}

WC_Calypso_Bridge_Customize_Store::get_instance();
Loading