Automattic\WooCommerce\Admin\Features\Blueprint
RestApi::can_import_blueprint
Check if blueprint imports are allowed based on site status, configuration, and session token.
Method of the class: RestApi{}
No Hooks.
Returns
true|false
. Returns true if imports are allowed, false otherwise.
Usage
// private - for code of main (parent) class only $result = $this->can_import_blueprint( $session_token );
- $session_token(string|null)
- Optional session token for import session.
Default: null
RestApi::can_import_blueprint() RestApi::can import blueprint code WC 9.9.5
private function can_import_blueprint( $session_token = null ) { // Allow import if a valid session token is present so when a site is turned into live during the import process, the import can continue. if ( $session_token && get_transient( 'blueprint_import_session_' . $session_token ) ) { return true; } // Check if override constant is defined and true. if ( defined( 'ALLOW_BLUEPRINT_IMPORT_IN_LIVE_MODE' ) && ALLOW_BLUEPRINT_IMPORT_IN_LIVE_MODE ) { return true; } // Only allow imports in coming soon mode. if ( $this->coming_soon_helper->is_site_live() ) { return false; } return true; }