Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

Products::possibly_add_manual_return_notice_script()publicWC 1.0

Adds a return to task list notice when completing the manual product task.

{} It's a method of the class: Products{}

No Hooks.

Return

null. Nothing.

Usage

$Products = new Products();
$Products->possibly_add_manual_return_notice_script( $hook );
$hook(string) (required)
Page hook.

Code of Products::possibly_add_manual_return_notice_script() WC 6.6.1

public function possibly_add_manual_return_notice_script( $hook ) {
	global $post;
	if ( 'post.php' !== $hook || 'product' !== $post->post_type ) {
		return;
	}

	if ( ! $this->is_active() || ! $this->is_complete() ) {
		return;
	}

	$script_assets_filename = WCAdminAssets::get_script_asset_filename( 'wp-admin-scripts', 'onboarding-product-notice' );
	$script_assets          = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;

	wp_enqueue_script(
		'onboarding-product-notice',
		WCAdminAssets::get_url( 'wp-admin-scripts/onboarding-product-notice', 'js' ),
		array_merge( array( WC_ADMIN_APP ), $script_assets ['dependencies'] ),
		WC_VERSION,
		true
	);

	// Clear the active task transient to only show notice once per active session.
	delete_transient( self::ACTIVE_TASK_TRANSIENT );
}