Automattic\WooCommerce\StoreApi\Utilities

AgenticCheckoutUtils::get_shared_paramspublic staticWC 1.0

Get the shared parameters schema for checkout session requests.

Method of the class: AgenticCheckoutUtils{}

No Hooks.

Returns

Array. Parameters array.

Usage

$result = AgenticCheckoutUtils::get_shared_params();

AgenticCheckoutUtils::get_shared_params() code WC 10.4.3

public static function get_shared_params() {
	return [
		'items'               => [
			'description' => __( 'Line items to add to the cart.', 'woocommerce' ),
			'type'        => 'array',
			'items'       => [
				'type'       => 'object',
				'properties' => [
					'id'       => [
						'description' => __( 'Product ID.', 'woocommerce' ),
						'type'        => 'string',
					],
					'quantity' => [
						'description' => __( 'Quantity.', 'woocommerce' ),
						'type'        => 'integer',
						'minimum'     => 1,
					],
				],
				'required'   => [ 'id', 'quantity' ],
			],
		],
		'buyer'               => [
			'description' => __( 'Buyer information.', 'woocommerce' ),
			'type'        => 'object',
			'properties'  => [
				'first_name'   => [
					'description' => __( 'First name.', 'woocommerce' ),
					'type'        => 'string',
				],
				'last_name'    => [
					'description' => __( 'Last name.', 'woocommerce' ),
					'type'        => 'string',
				],
				'email'        => [
					'description' => __( 'Email address.', 'woocommerce' ),
					'type'        => 'string',
					'format'      => 'email',
				],
				'phone_number' => [
					'description' => __( 'Phone number.', 'woocommerce' ),
					'type'        => 'string',
				],
			],
		],
		'fulfillment_address' => [
			'description' => __( 'Fulfillment/shipping address.', 'woocommerce' ),
			'type'        => 'object',
			'properties'  => [
				'name'        => [
					'description' => __( 'Full name.', 'woocommerce' ),
					'type'        => 'string',
				],
				'line_one'    => [
					'description' => __( 'Address line 1.', 'woocommerce' ),
					'type'        => 'string',
				],
				'line_two'    => [
					'description' => __( 'Address line 2.', 'woocommerce' ),
					'type'        => 'string',
				],
				'city'        => [
					'description' => __( 'City.', 'woocommerce' ),
					'type'        => 'string',
				],
				'state'       => [
					'description' => __( 'State/province.', 'woocommerce' ),
					'type'        => 'string',
				],
				'country'     => [
					'description' => __( 'Country code (ISO 3166-1 alpha-2).', 'woocommerce' ),
					'type'        => 'string',
				],
				'postal_code' => [
					'description' => __( 'Postal/ZIP code.', 'woocommerce' ),
					'type'        => 'string',
				],
			],
			'required'    => [ 'line_one', 'city', 'country', 'postal_code' ],
		],
	];
}