Automattic\WooCommerce\Admin\API

OnboardingProfile::update_items()publicWC 1.0

Update onboarding profile data.

{} Это метод класса: OnboardingProfile{}

Хуки из метода

Возвращает

WP_Error|WP_REST_Response.

Использование

$OnboardingProfile = new OnboardingProfile();
$OnboardingProfile->update_items( $request );
$request(WP_REST_Request) (обязательный)
Request data.

Код OnboardingProfile::update_items() WC 6.9.1

public function update_items( $request ) {
	$params          = $request->get_json_params();
	$query_args      = $this->prepare_objects_query( $params );
	$onboarding_data = (array) get_option( Profile::DATA_OPTION, array() );
	$profile_data    = array_merge( $onboarding_data, $query_args );
	update_option( Profile::DATA_OPTION, $profile_data );
	do_action( 'woocommerce_onboarding_profile_data_updated', $onboarding_data, $query_args );

	$result = array(
		'status'  => 'success',
		'message' => __( 'Onboarding profile data has been updated.', 'woocommerce' ),
	);

	$response = $this->prepare_item_for_response( $result, $request );
	$data     = $this->prepare_response_for_collection( $response );

	return rest_ensure_response( $data );
}