woocommerce / woocommerce-blocks

(Deprecated) This plugin has been merged into woocommerce/woocommerce
https://wordpress.org/plugins/woo-gutenberg-products-block/
GNU General Public License v3.0
405 stars 218 forks source link

REST API: Customer Session Data #1320

Closed mikejolley closed 4 years ago

mikejolley commented 4 years ago

Stores session data for the current customer, including addresses, user ID, and email if known.

GET /customer POST /customer

This will be used during cart and checkout to store provided address information.

Properties, adapted from core customers API:

'id'                 => array(
  'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ),
  'type'        => 'integer',
  'context'     => array( 'view', 'edit' ),
  'readonly'    => true,
),
'billing'            => array(
  'description' => __( 'List of billing address data.', 'woocommerce-rest-api' ),
  'type'        => 'object',
  'context'     => array( 'view', 'edit' ),
  'properties'  => array(
    'first_name' => array(
      'description' => __( 'First name.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'last_name'  => array(
      'description' => __( 'Last name.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'company'    => array(
      'description' => __( 'Company name.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'address_1'  => array(
      'description' => __( 'Address line 1', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'address_2'  => array(
      'description' => __( 'Address line 2', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'city'       => array(
      'description' => __( 'City name.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'state'      => array(
      'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'postcode'   => array(
      'description' => __( 'Postal code.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'country'    => array(
      'description' => __( 'ISO code of the country.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'email'      => array(
      'description' => __( 'Email address.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'format'      => 'email',
      'context'     => array( 'view', 'edit' ),
    ),
    'phone'      => array(
      'description' => __( 'Phone number.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
  ),
),
'shipping'           => array(
  'description' => __( 'List of shipping address data.', 'woocommerce-rest-api' ),
  'type'        => 'object',
  'context'     => array( 'view', 'edit' ),
  'properties'  => array(
    'first_name' => array(
      'description' => __( 'First name.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'last_name'  => array(
      'description' => __( 'Last name.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'company'    => array(
      'description' => __( 'Company name.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'address_1'  => array(
      'description' => __( 'Address line 1', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'address_2'  => array(
      'description' => __( 'Address line 2', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'city'       => array(
      'description' => __( 'City name.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'state'      => array(
      'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'postcode'   => array(
      'description' => __( 'Postal code.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
    'country'    => array(
      'description' => __( 'ISO code of the country.', 'woocommerce-rest-api' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit' ),
    ),
  ),
),

Questions:

Tasks:

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label type: feature request to this issue, with a confidence of 0.91. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.