Automattic\WooCommerce\Internal\Admin\Schedulers

MailchimpScheduler::make_request()publicWC 1.0

Make an HTTP request to the API.

Method of the class: MailchimpScheduler{}

No Hooks.

Return

Mixed.

Usage

$MailchimpScheduler = new MailchimpScheduler();
$MailchimpScheduler->make_request( $store_email, $address );
$store_email(string) (required)
Email address to subscribe.
$address(array) (required)
Store address.

MailchimpScheduler::make_request() code WC 9.4.2

public function make_request( $store_email, $address ) {
	if ( true === defined( 'WP_ENVIRONMENT_TYPE' ) && 'development' === constant( 'WP_ENVIRONMENT_TYPE' ) ) {
		$subscribe_endpoint = self::SUBSCRIBE_ENDPOINT_DEV;
	} else {
		$subscribe_endpoint = self::SUBSCRIBE_ENDPOINT;
	}

	return wp_remote_post(
		$subscribe_endpoint,
		array(
			'user-agent' => 'WooCommerce/' . WC()->version . '; ' . get_bloginfo( 'url' ),
			'method'     => 'POST',
			'body'       => array(
				'email'   => $store_email,
				'address' => $address,
			),
		)
	);
}