Automattic\WooCommerce\Internal\RestApi\Routes\V4\Customers
CustomerSchema::get_item_schema_properties │ public │ WC 1.0
Return all properties for the item schema.
Method of the class: CustomerSchema{}
No Hooks.
Returns
Array.
Usage
$CustomerSchema = new CustomerSchema(); $CustomerSchema->get_item_schema_properties(): array;
CustomerSchema::get_item_schema_properties() CustomerSchema::get item schema properties code WC 10.4.3
public function get_item_schema_properties(): array {
$schema = array(
'id' => array(
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
'type' => 'integer',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'date_created' => array(
'description' => __( "The date the customer was created, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'date_created_gmt' => array(
'description' => __( 'The date the customer was created, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'date_modified' => array(
'description' => __( "The date the customer was last modified, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'date_modified_gmt' => array(
'description' => __( 'The date the customer was last modified, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'email' => array(
'description' => __( 'The email address for the customer.', 'woocommerce' ),
'type' => 'string',
'format' => 'email',
'context' => self::VIEW_EDIT_CONTEXT,
),
'first_name' => array(
'description' => __( 'Customer first name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
),
'last_name' => array(
'description' => __( 'Customer last name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
),
'role' => array(
'description' => __( 'Customer role.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'username' => array(
'description' => __( 'Customer login name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
'arg_options' => array(
'sanitize_callback' => 'sanitize_user',
),
),
'billing' => array(
'description' => __( 'List of billing address data.', 'woocommerce' ),
'type' => 'object',
'context' => self::VIEW_EDIT_CONTEXT,
'properties' => array(
'first_name' => array(
'description' => __( 'First name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'last_name' => array(
'description' => __( 'Last name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'company' => array(
'description' => __( 'Company name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'address_1' => array(
'description' => __( 'Address line 1', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'address_2' => array(
'description' => __( 'Address line 2', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'city' => array(
'description' => __( 'City name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'state' => array(
'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'postcode' => array(
'description' => __( 'Postal code.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'country' => array(
'description' => __( 'ISO code of the country.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'email' => array(
'description' => __( 'Email address.', 'woocommerce' ),
'type' => 'string',
'format' => 'email',
'context' => self::VIEW_EDIT_CONTEXT,
),
'phone' => array(
'description' => __( 'Phone number.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
),
),
'shipping' => array(
'description' => __( 'List of shipping address data.', 'woocommerce' ),
'type' => 'object',
'context' => self::VIEW_EDIT_CONTEXT,
'properties' => array(
'first_name' => array(
'description' => __( 'First name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'last_name' => array(
'description' => __( 'Last name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'company' => array(
'description' => __( 'Company name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'address_1' => array(
'description' => __( 'Address line 1', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'address_2' => array(
'description' => __( 'Address line 2', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'city' => array(
'description' => __( 'City name.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'state' => array(
'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'postcode' => array(
'description' => __( 'Postal code.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'country' => array(
'description' => __( 'ISO code of the country.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
'phone' => array(
'description' => __( 'Phone number.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
),
),
),
'is_paying_customer' => array(
'description' => __( 'Is the customer a paying customer?', 'woocommerce' ),
'type' => 'boolean',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'orders_count' => array(
'description' => __( 'Quantity of orders made by the customer.', 'woocommerce' ),
'type' => 'integer',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'total_spent' => array(
'description' => __( 'Total amount spent.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'avatar_url' => array(
'description' => __( 'Avatar URL.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'last_active' => array(
'description' => __( "When the customer was last active in the site's timezone.", 'woocommerce' ),
'type' => array( 'null', 'string' ),
'format' => 'date-time',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
'last_active_gmt' => array(
'description' => __( 'When the customer was last active, as GMT.', 'woocommerce' ),
'type' => array( 'null', 'string' ),
'format' => 'date-time',
'context' => self::VIEW_EDIT_CONTEXT,
'readonly' => true,
),
);
return $schema;
}