Automattic\WooCommerce\Internal\Fulfillments

OrderFulfillmentsRestController::get_write_args_for_fulfillmentprivateWC 1.0

Get the base args for the fulfillment with a write context.

Method of the class: OrderFulfillmentsRestController{}

No Hooks.

Returns

Array.

Usage

// private - for code of main (parent) class only
$result = $this->get_write_args_for_fulfillment( $is_create );
$is_create(true|false)
Whether the args list is for a create request.
Default: false

OrderFulfillmentsRestController::get_write_args_for_fulfillment() code WC 10.3.3

private function get_write_args_for_fulfillment( bool $is_create = false ) {
	return array_merge(
		! $is_create ? array(
			'fulfillment_id' => array(
				'description' => __( 'Unique identifier for the fulfillment.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
		) : array(),
		array(
			'status'          => array(
				'description' => __( 'The status of the fulfillment.', 'woocommerce' ),
				'type'        => 'string',
				'default'     => 'unfulfilled',
				'required'    => false,
				'context'     => array( 'view', 'edit' ),
			),
			'is_fulfilled'    => array(
				'description' => __( 'Whether the fulfillment is fulfilled.', 'woocommerce' ),
				'type'        => 'boolean',
				'default'     => false,
				'required'    => false,
				'context'     => array( 'view', 'edit' ),
			),
			'meta_data'       => array(
				'description' => __( 'Meta data for the fulfillment.', 'woocommerce' ),
				'type'        => 'array',
				'required'    => true,
				'schema'      => $this->get_schema_for_meta_data(),
			),
			'notify_customer' => array(
				'description' => __( 'Whether to notify the customer about the fulfillment update.', 'woocommerce' ),
				'type'        => 'boolean',
				'default'     => false,
				'required'    => false,
				'context'     => array( 'view', 'edit' ),
			),
		)
	);
}