Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Shopify

ShopifyClient::get_credentialsprivateWC 1.0

Get Shopify API credentials.

Method of the class: ShopifyClient{}

No Hooks.

Returns

Array|\WP_Error. Array with 'domain' and 'access_token' keys, or WP_Error on failure.

Usage

// private - for code of main (parent) class only
$result = $this->get_credentials();

ShopifyClient::get_credentials() code WC 10.7.0

private function get_credentials() {
	if ( empty( $this->credentials['shop_url'] ) || empty( $this->credentials['access_token'] ) ) {
		return new \WP_Error(
			'api_error',
			'Shopify API credentials (shop_url, access_token) are not configured. Please run: wp wc migrate setup'
		);
	}

	// Map the stored credential keys to the expected format.
	return array(
		'domain'       => $this->credentials['shop_url'],
		'access_token' => $this->credentials['access_token'],
	);
}