Categories
WooCommerce

WooCommerce REST API

And the Copyrights.

Creating sign-up form for some WooCommerce website (source website) in another website (destination website): in the source website create application passwords, in the destination website create sign-up form with the plugin and use the code (update the source website address and the access details):

add_action( 'wpcf7_posted_data', 'condless_create_remote_user' );
function condless_create_remote_user( $posted_data ) {
	$api_response = wp_remote_post( 'https://example.com/wp-json/wp/v2/users/', [
		'headers' => [ 'Authorization' => 'Basic ' . base64_encode( 'LOGIN:PASSWORD' ) ],
		'body' => [
			'username'	=> $posted_data['your-name'],
			'email' 	=> $posted_data['your-email'],
			'password'	=> $posted_data['your-password'],
		]
	] );
	$body = json_decode( $api_response['body'] );
	if ( 'OK' === wp_remote_retrieve_response_message( $api_response ) ) {
		// Do something with $body
	}
}

As you probably have noticed- the largest Copyright controversy was agains Google for having distributed a new implementation of Java embedded in the Android operating system, the controversy reached the Supreme Court of the United States.

Leave a Reply

Your email address will not be published. Required fields are marked *