Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can find more basket examples in the API browser applicationbrowserapplication .

BasketItem

Field

Description

basketItem

Representation of a basket item on the platform.

basketItem/description

A text that describes the basket item. Usually the article or product text. Will be generated automatically on basket item creation.

basketItem/quantity

The number of items the customer wants to buy. Is always an int > 0. In case you want to delete a basket item use HTTP DELETE method! This attribute is mandatory for basket item creations.

basketItem/element

The abstract element that you want to place into the basket.

basketItem/element/@id

The id of the abstract thing the customer bought. Allowed right now are Spreadshirt article id and product ids. Will be set automatically on basket item creation.

basketItem/element/@xlink:href

A link to the actual concrete element you placed into the basket. Can be either a link to a Spreadshirt article or product right now (see Retrieve Product and Retrieve Article ). This attribute is mandatory for basket item creations.

basketItem/element/@type

The actual type of the abstract element which makes it to a concrete one. Can be sprd:article or sprd:product for Spreadshirt articles or products right now. Type is mandatory for basket item creations.

basketItem/element/properties

A list of properties that further refine the abstract element.

basketItem/element/properties/property

A property value that corresponds to the property key, e.g. size:2 or appearance:1. Properties might be different depending on the element type. Spreadshirt articles and products support size and appearance only. Properties are mandatory for basket item creations.

basketItem/element/properties/property/@key

appearance: 1 (Depends on the product type. Check the productType resource to determine the appearanceId)
size: 2 (Depends on the product type. Check the productType resource to determine the sizeId)
appearanceLabel: i18n name of product type appearance, e.g. Red
sizeLabel: i18n name of product type size, e.g. M
appearanceLink: link to product type appearance color image, e.g. http://image.spreadshirt.net/image-server/v1/appearances/15

basketItem/links

list of links that belong to actions that can be executed for this basket item

basketItem/links/link

concrete link of link list

basketItem/links/link@type

link type that can be either edit or continueShopping. edit link is the link displayed in checkout for editing the basket item. continueShopping link is used in checkout as link for continue shopping button.

basketItem/links/link@xlink:href

actual URL

basketItem/discounts

The possible discounts and the discount value per single item that applies.

basketItem/priceItem

The single basket item price without reductions through discounts, etc..

basketItem/price

The single basket item price. Price is calculated by the API. Price contains discount reductions.

basketItem/shop

In case of mixed mode basket, a reference to the shop where the customer bought the item.

basketItem/origin

Reference to the origin of the basket. Origin can be used to tell the platform, where the basket item actually comes from, i.e. from which product or sales channel.

...

Code Block
<basketItem
	xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns="http://api.spreadshirt.net"
	xlink:href="https://api.spreadshirt.net/api/v1/baskets/0cd283f7-5b24-407a-9a9c-a081455e1030/items/a561dcbb-9065-4e45-ad20-aba2bd8a6afa"
            id="a561dcbb-9065-4e45-ad20-aba2bd8a6afa">
   <!-- optional for mixed mode -->
   <shop id="40000" xlink:href="http://api.spreadshirt.net/v1/shops/42">
   <description>Basket Item description</description>
   <quantity>2</quantity>
   <element id="456" type="sprd:article" xlink:href="https://api.spreadshirt.net/v1/shops/42/articles/456">
      <properties>
         <property key="appearance">15</property>
         <property key="size">12</property>
      </properties>
   </element>
   <links>
      <link type="edit" xlink:href="http://www.yourdomain.de/article/123/edit"/>
      <link type="continueShopping" xlink:href="http://www.yourdomain.de"/>
   </links>
   <discounts>
      <discount>
         <discountScale id="1" xlink:href="https://api.spreadshirt.net/api/v1/shops/205909/discountScales/1"/>
         <currentDiscount id="10"/>
         <nextDiscount id="11"/>
         <price>
            <currency id="1" xlink:href="https://api.spreadshirt.net/v1/currencies/1"/>
            <vatIncluded>2.0</vatIncluded>
            <vatExcluded>0.38</vatExcluded>
            <vat>19.0</vat>
         </price>
      </discount>
   </discounts>
   <priceItem>
      <currency id="1" xlink:href="https://api.spreadshirt.net/v1/currencies/1"/>
      <vatIncluded>12.0</vatIncluded>
      <vatExcluded>9.72</vatExcluded>
      <vat>19.00</vat>
   <priceItem>   
   <price>
      <currency id="1" xlink:href="https://api.spreadshirt.net/v1/currencies/1"/>
      <vatIncluded>10.0</vatIncluded>
      <vatExcluded>8.1</vatExcluded>
      <vat>19.00</vat>
   </price>
</basketItem>

You can find more basket item examples in the API browser application .

Discount calculation example

...