Overview:
The basket is a core component of the shopping experience in Norce Commerce Services. It acts as a container for items a visitor is interested in purchasing. The basket model includes extensive functionality and is governed by business rules that are evaluated with every action performed by the visitor.
Note: While the most common use of the basket is as a shopping cart, it can also be used for wish lists, approvals, saved-for-later lists, punch-out, subscriptions, and recurring orders. This document focuses on the shopping cart scenario.
Example: Basket Data (JSON and XML)
Below are example representations of a basket in both JSON and XML formats. These examples illustrate the structure and key fields of a Norce Commerce basket.
{
"Id": 6600304,
"CustomerId": null,
"CompanyId": null,
"SalesContactId": null,
"StatusId": 3,
"CurrencyId": 2,
"CurrencyCode": "SEK",
"Comment": null,
"OrderReference": null,
"DiscountCode": null,
"ReferId": null,
"ReferUrl": null,
"ValidTo": null,
"IsEditable": true,
"Items": [
{
"Id": 16030464,
"LineNo": 1,
"ParentLineNo": null,
"ProductId": 31234584,
"PartNo": "PRD0001270",
"ManufacturerPartNo": "T540XP",
"Name": "T540XP",
"SubHeader": "<p>Detta är en kort beskrivning.</p>",
"ThumbnailImage": "2/thumb_p31234584.jpg",
"FlagIdSeed": "915,1884",
"Type": 1,
"PriceDisplay": 5743.20,
"Price": 0.00,
"PriceOriginal": 5743.20,
"Cost": 5734.34,
"VatRate": 1.2500,
"Quantity": 1.000,
"UOM": "st",
"UOMCount": 1.000,
"Comment": null,
"PriceListId": 4654,
"ReferId": null,
"ReferUrl": null,
"IsEditable": true,
"IsDiscountable": true,
"Info": [
{
"TypeId": 209,
"Value": "",
"Code": "bit_size"
},
{
"TypeId": 241,
"Value": "",
"Code": "bit_del_time"
},
{
"TypeId": 95,
"Value": "",
"Code": "bit_additionalinformation"
}
],
"OptionalItems": [],
"OnHandValue": 0.000,
"IncomingValue": 0.000,
"NextDeliveryDate": null,
"LeadtimeDayCount": null,
"PromotionIdSeed": "",
"ImageKey": "39e4b7ec-12d8-4f6e-b9c1-cbd7334190e1",
"ManufacturerName": "Husqvarna",
"CategoryId": 41722,
"OnHand": {
"Value": 0.000,
"IncomingValue": 0.000,
"NextDeliveryDate": null,
"LeadtimeDayCount": null,
"LastChecked": null,
"IsActive": false,
"IsReturnable": true,
"Info": null
},
"OnHandSupplier": {
"Value": 200.000,
"IncomingValue": 0.000,
"NextDeliveryDate": null,
"LeadtimeDayCount": 7,
"LastChecked": null,
"IsActive": true,
"IsReturnable": true,
"Info": null
},
"PriceRecommended": 7000.00,
"ManufacturerId": 1685,
"UniqueName": "t540xp",
"StatusId": 1,
"StockDisplayBreakPoint": null,
"PriceCatalog": null,
"IsBuyable": true,
"SubDescription": null,
"CategoryIdSeed": "41722",
"RecommendedQuantity": 4.000,
"IsRecommendedQuantityFixed": false,
"AppliedPromotions": [],
"RequirementPromotionIdSeed": "5093",
"IsSubscribable": false,
"DescriptionHeader": "Husqvarna T540XP",
"IsPriceManual": false,
"PriceStandard": 6375.20,
"EanCode": "123123123123123",
"CostUnit": 0.00,
"PriceDisplayIncVat": 7179.00
},
{
"Id": 16030465,
"LineNo": 2,
"ParentLineNo": null,
"ProductId": 24706222,
"PartNo": "PRD0001212",
"ManufacturerPartNo": "FREIGHT01",
"Name": "Freight",
"SubHeader": null,
"ThumbnailImage": null,
"FlagIdSeed": "915",
"Type": 3,
"PriceDisplay": 0.00,
"Price": 0.00,
"PriceOriginal": 0.00,
"Cost": 0.00,
"VatRate": 1.25,
"Quantity": 1.000,
"UOM": "st",
"UOMCount": 1.000,
"Comment": null,
"PriceListId": 1,
"ReferId": null,
"ReferUrl": null,
"IsEditable": true,
"IsDiscountable": true,
"Info": [
{
"TypeId": 209,
"Value": "",
"Code": "bit_size"
},
{
"TypeId": 241,
"Value": "",
"Code": "bit_del_time"
},
{
"TypeId": 95,
"Value": "",
"Code": "bit_additionalinformation"
}
],
"OptionalItems": [],
"OnHandValue": 0.000,
"IncomingValue": 0.000,
"NextDeliveryDate": null,
"LeadtimeDayCount": 0,
"PromotionIdSeed": null,
"ImageKey": null,
"ManufacturerName": "Miscellaneous",
"CategoryId": null,
"OnHand": {
"Value": 0.000,
"IncomingValue": 0.000,
"NextDeliveryDate": null,
"LeadtimeDayCount": 0,
"LastChecked": "/Date(1325504774807+0100)/",
"IsActive": true,
"IsReturnable": true,
"Info": null
},
"OnHandSupplier": {
"Value": 0.000,
"IncomingValue": 0.000,
"NextDeliveryDate": null,
"LeadtimeDayCount": null,
"LastChecked": null,
"IsActive": false,
"IsReturnable": true,
"Info": null
},
"PriceRecommended": null,
"ManufacturerId": 4335,
"UniqueName": "freight",
"StatusId": 1,
"StockDisplayBreakPoint": null,
"PriceCatalog": null,
"IsBuyable": true,
"SubDescription": null,
"CategoryIdSeed": "",
"RecommendedQuantity": 1.000,
"IsRecommendedQuantityFixed": false,
"AppliedPromotions": [],
"RequirementPromotionIdSeed": null,
"IsSubscribable": false,
"DescriptionHeader": null,
"IsPriceManual": false,
"PriceStandard": 0.00,
"EanCode": "",
"CostUnit": 0.00,
"PriceDisplayIncVat": 0.00
},
{
"Id": 0,
"LineNo": 3,
"ParentLineNo": 1,
"ProductId": 31234588,
"PartNo": "PRD0001274",
"ManufacturerPartNo": "Underhållskit",
"Name": "Underhållskit Motorsåg",
"SubHeader": null,
"ThumbnailImage": "2/thumb_p31234588.png",
"FlagIdSeed": "915",
"Type": 1,
"PriceDisplay": 111.20,
"Price": 0.00,
"PriceOriginal": 111.20,
"Cost": 100.25,
"VatRate": 1.25,
"Quantity": 1,
"UOM": "st",
"UOMCount": 1.000,
"Comment": null,
"PriceListId": 1,
"ReferId": null,
"ReferUrl": null,
"IsEditable": false,
"IsDiscountable": true,
"Info": [
{
"TypeId": 209,
"Value": "",
"Code": "bit_size"
},
{
"TypeId": 241,
"Value": "",
"Code": "bit_del_time"
},
{
"TypeId": 95,
"Value": "",
"Code": "bit_additionalinformation"
}
],
"OptionalItems": [],
"OnHandValue": 12.000,
"IncomingValue": 0.000,
"NextDeliveryDate": null,
"LeadtimeDayCount": 0,
"PromotionIdSeed": "",
"ImageKey": null,
"ManufacturerName": "Husqvarna",
"CategoryId": 41722,
"OnHand": {
"Value": 12.000,
"IncomingValue": 0.000,
"NextDeliveryDate": null,
"LeadtimeDayCount": 0,
"LastChecked": null,
"IsActive": true,
"IsReturnable": true,
"Info": null
},
"OnHandSupplier": {
"Value": 133.000,
"IncomingValue": 0.000,
"NextDeliveryDate": null,
"LeadtimeDayCount": 5,
"LastChecked": "/Date(1487085555163+0100)/",
"IsActive": true,
"IsReturnable": true,
"Info": null
},
"PriceRecommended": null,
"ManufacturerId": 1685,
"UniqueName": "underhallskit-motorsag",
"StatusId": 1,
"StockDisplayBreakPoint": null,
"PriceCatalog": null,
"IsBuyable": true,
"SubDescription": null,
"CategoryIdSeed": "41722",
"RecommendedQuantity": 1.000,
"IsRecommendedQuantityFixed": false,
"AppliedPromotions": [],
"RequirementPromotionIdSeed": "",
"IsSubscribable": false,
"DescriptionHeader": null,
"IsPriceManual": false,
"PriceStandard": 0.00,
"EanCode": "345345345345345",
"CostUnit": 0.00,
"PriceDisplayIncVat": 139.00
}
],
"Info": [
{
"TypeId": 169,
"Value": "",
"Code": "bit_expecteddeliverydate"
},
{
"TypeId": 293,
"Value": "",
"Code": "bit_additionalorderinfo"
},
{
"TypeId": 445,
"Value": "",
"Code": "Norce_Gender"
},
{
"TypeId": 493,
"Value": "",
"Code": "recurring"
}
],
"Summary": {
"Items": {
"Amount": 5854.40,
"Vat": 1463.60,
"AmountIncVat": 7318.00
},
"Freigt": {
"Amount": 0.00,
"Vat": 0.00,
"AmountIncVat": 0.00
},
"Fees": {
"Amount": 0.00,
"Vat": 0.00,
"AmountIncVat": 0.00
},
"Total": {
"Amount": 5854.40,
"Vat": 1463.60,
"AmountIncVat": 7318.00
}
},
"AppliedPromotions": [
{
"Id": 5093,
"Name": "Add service",
"Header": "",
"ShortDescription": "",
"Description1": "",
"Description2": "",
"StartDate": null,
"EndDate": null,
"ImageKey": null,
"RequirementSeed": "3",
"DiscountCode": null,
"IsExcludedFromPriceCalculation": false,
"AllowProductListing": false,
"Images": [],
"ProductFilters": [
{
"ManufacturerId": null,
"CategorySeed": null,
"TypeId": null,
"ProductId": null,
"VariantProductId": null,
"PartNo": "PRD0001274",
"PricelistId": 1,
"FlagId": null
},
{
"ManufacturerId": null,
"CategorySeed": null,
"TypeId": null,
"ProductId": null,
"VariantProductId": null,
"PartNo": null,
"PricelistId": null,
"FlagId": 1884
}
],
"AppliedAmount": 0.00,
"EffectSeed": "5",
"FreightDiscountPct": null,
"IsStackable": true,
"AppliedAmountIncVat": 0.00
}
],
"IpAddress": "151.236.200.213",
"AttestedBy": null,
"TypeId": 1,
"DoHold": false,
"IsBuyable": true,
"InvoiceReference": null,
"PaymentMethodId": null,
"DeliveryMethodId": 1,
"SalesAreaId": 1
}
<Basket xmlns="Enferno.Services.Contracts.Expose.Shopping" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Id>6600304</Id>
<CustomerId i:nil="true"/>
<CompanyId i:nil="true"/>
<SalesContactId i:nil="true"/>
<StatusId>3</StatusId>
<CurrencyId>2</CurrencyId>
<CurrencyCode>SEK</CurrencyCode>
<Comment i:nil="true"/>
<OrderReference i:nil="true"/>
<DiscountCode i:nil="true"/>
<ReferId i:nil="true"/>
<ReferUrl i:nil="true"/>
<ValidTo i:nil="true"/>
<IsEditable>true</IsEditable>
<Items>
<BasketItem>
<Id>16030464</Id>
<LineNo>1</LineNo>
<ParentLineNo i:nil="true"/>
<ProductId>31234584</ProductId>
<PartNo>PRD0001270</PartNo>
<ManufacturerPartNo>T540XP</ManufacturerPartNo>
<Name>T540XP</Name>
<SubHeader><p>Detta är en kort beskrivning.</p></SubHeader>
<ThumbnailImage>2/thumb_p31234584.jpg</ThumbnailImage>
<FlagIdSeed>915,1884</FlagIdSeed>
<Type>1</Type>
<PriceDisplay>5743.20</PriceDisplay>
<Price>0.00</Price>
<PriceOriginal>5743.20</PriceOriginal>
<Cost>5734.34</Cost>
<VatRate>1.25</VatRate>
<Quantity>1</Quantity>
<UOM>st</UOM>
<UOMCount>1.000</UOMCount>
<Comment i:nil="true"/>
<PriceListId>4654</PriceListId>
<ReferId i:nil="true"/>
<ReferUrl i:nil="true"/>
<IsEditable>true</IsEditable>
<IsDiscountable>true</IsDiscountable>
<Info>
<Info>
<TypeId>209</TypeId>
<Value/>
<Code>bit_size</Code>
</Info>
<Info>
<TypeId>241</TypeId>
<Value/>
<Code>bit_del_time</Code>
</Info>
<Info>
<TypeId>95</TypeId>
<Value/>
<Code>bit_additionalinformation</Code>
</Info>
</Info>
<OptionalItems/>
<OnHandValue>0.000</OnHandValue>
<IncomingValue>0.000</IncomingValue>
<NextDeliveryDate i:nil="true"/>
<LeadtimeDayCount i:nil="true"/>
<PromotionIdSeed/>
<ImageKey>39e4b7ec-12d8-4f6e-b9c1-cbd7334190e1</ImageKey>
<ManufacturerName>Husqvarna</ManufacturerName>
<CategoryId>41722</CategoryId>
<OnHand xmlns:a="Enferno.Services.Contracts.Expose.Products">
<a:Value>0.000</a:Value>
<a:IncomingValue>0.000</a:IncomingValue>
<a:NextDeliveryDate i:nil="true"/>
<a:LeadtimeDayCount i:nil="true"/>
<a:LastChecked i:nil="true"/>
<a:IsActive>false</a:IsActive>
<a:IsReturnable>true</a:IsReturnable>
<a:Info i:nil="true" xmlns:b="Enferno.Services.Contracts.Expose"/>
</OnHand>
<OnHandSupplier xmlns:a="Enferno.Services.Contracts.Expose.Products">
<a:Value>200.000</a:Value>
<a:IncomingValue>0.000</a:IncomingValue>
<a:NextDeliveryDate i:nil="true"/>
<a:LeadtimeDayCount>7</a:LeadtimeDayCount>
<a:LastChecked i:nil="true"/>
<a:IsActive>true</a:IsActive>
<a:IsReturnable>true</a:IsReturnable>
<a:Info i:nil="true" xmlns:b="Enferno.Services.Contracts.Expose"/>
</OnHandSupplier>
<PriceRecommended>7000.00</PriceRecommended>
<ManufacturerId>1685</ManufacturerId>
<UniqueName>t540xp</UniqueName>
<StatusId>1</StatusId>
<StockDisplayBreakPoint i:nil="true"/>
<PriceCatalog i:nil="true"/>
<IsBuyable>true</IsBuyable>
<SubDescription i:nil="true"/>
<CategoryIdSeed>41722</CategoryIdSeed>
<RecommendedQuantity>4.000</RecommendedQuantity>
<IsRecommendedQuantityFixed>false</IsRecommendedQuantityFixed>
<AppliedPromotions/>
<RequirementPromotionIdSeed>5093</RequirementPromotionIdSeed>
<IsSubscribable>false</IsSubscribable>
<DescriptionHeader>Husqvarna T540XP</DescriptionHeader>
<IsPriceManual>false</IsPriceManual>
<PriceStandard>6375.20</PriceStandard>
<EanCode>123123123123123</EanCode>
<CostUnit>0.00</CostUnit>
<PriceDisplayIncVat>7179.00</PriceDisplayIncVat>
</BasketItem>
<BasketItem>
<Id>16030465</Id>
<LineNo>2</LineNo>
<ParentLineNo i:nil="true"/>
<ProductId>24706222</ProductId>
<PartNo>PRD0001212</PartNo>
<ManufacturerPartNo>FREIGHT01</ManufacturerPartNo>
<Name>Freight</Name>
<SubHeader i:nil="true"/>
<ThumbnailImage i:nil="true"/>
<FlagIdSeed>915</FlagIdSeed>
<Type>3</Type>
<PriceDisplay>0.00</PriceDisplay>
<Price>0.00</Price>
<PriceOriginal>0.00</PriceOriginal>
<Cost>0.00</Cost>
<VatRate>1.25</VatRate>
<Quantity>1</Quantity>
<UOM>st</UOM>
<UOMCount>1.000</UOMCount>
<Comment i:nil="true"/>
<PriceListId>1</PriceListId>
<ReferId i:nil="true"/>
<ReferUrl i:nil="true"/>
<IsEditable>true</IsEditable>
<IsDiscountable>true</IsDiscountable>
<Info>
<Info>
<TypeId>209</TypeId>
<Value/>
<Code>bit_size</Code>
</Info>
<Info>
<TypeId>241</TypeId>
<Value/>
<Code>bit_del_time</Code>
</Info>
<Info>
<TypeId>95</TypeId>
<Value/>
<Code>bit_additionalinformation</Code>
</Info>
</Info>
<OptionalItems/>
<OnHandValue>0.000</OnHandValue>
<IncomingValue>0.000</IncomingValue>
<NextDeliveryDate i:nil="true"/>
<LeadtimeDayCount>0</LeadtimeDayCount>
<PromotionIdSeed i:nil="true"/>
<ImageKey i:nil="true"/>
<ManufacturerName>Miscellaneous</ManufacturerName>
<CategoryId i:nil="true"/>
<OnHand xmlns:a="Enferno.Services.Contracts.Expose.Products">
<a:Value>0.000</a:Value>
<a:IncomingValue>0.000</a:IncomingValue>
<a:NextDeliveryDate i:nil="true"/>
<a:LeadtimeDayCount>0</a:LeadtimeDayCount>
<a:LastChecked>2012-01-02T12:46:14.807</a:LastChecked>
<a:IsActive>true</a:IsActive>
<a:IsReturnable>true</a:IsReturnable>
<a:Info i:nil="true" xmlns:b="Enferno.Services.Contracts.Expose"/>
</OnHand>
<OnHandSupplier xmlns:a="Enferno.Services.Contracts.Expose.Products">
<a:Value>0.000</a:Value>
<a:IncomingValue>0.000</a:IncomingValue>
<a:NextDeliveryDate i:nil="true"/>
<a:LeadtimeDayCount i:nil="true"/>
<a:LastChecked i:nil="true"/>
<a:IsActive>false</a:IsActive>
<a:IsReturnable>true</a:IsReturnable>
<a:Info i:nil="true" xmlns:b="Enferno.Services.Contracts.Expose"/>
</OnHandSupplier>
<PriceRecommended i:nil="true"/>
<ManufacturerId>4335</ManufacturerId>
<UniqueName>freight</UniqueName>
<StatusId>1</StatusId>
<StockDisplayBreakPoint i:nil="true"/>
<PriceCatalog i:nil="true"/>
<IsBuyable>true</IsBuyable>
<SubDescription i:nil="true"/>
<CategoryIdSeed/>
<RecommendedQuantity>1.000</RecommendedQuantity>
<IsRecommendedQuantityFixed>false</IsRecommendedQuantityFixed>
<AppliedPromotions/>
<RequirementPromotionIdSeed i:nil="true"/>
<IsSubscribable>false</IsSubscribable>
<DescriptionHeader i:nil="true"/>
<IsPriceManual>false</IsPriceManual>
<PriceStandard>0.00</PriceStandard>
<EanCode/>
<CostUnit>0.00</CostUnit>
<PriceDisplayIncVat>0.00</PriceDisplayIncVat>
</BasketItem>
<BasketItem>
<Id>0</Id>
<LineNo>3</LineNo>
<ParentLineNo>1</ParentLineNo>
<ProductId>31234588</ProductId>
<PartNo>PRD0001274</PartNo>
<ManufacturerPartNo>Underhållskit</ManufacturerPartNo>
<Name>Underhållskit Motorsåg</Name>
<SubHeader i:nil="true"/>
<ThumbnailImage>2/thumb_p31234588.png</ThumbnailImage>
<FlagIdSeed>915</FlagIdSeed>
<Type>1</Type>
<PriceDisplay>111.20</PriceDisplay>
<Price>0.00</Price>
<PriceOriginal>111.20</PriceOriginal>
<Cost>100.25</Cost>
<VatRate>1.25</VatRate>
<Quantity>1</Quantity>
<UOM>st</UOM>
<UOMCount>1.000</UOMCount>
<Comment i:nil="true"/>
<PriceListId>1</PriceListId>
<ReferId i:nil="true"/>
<ReferUrl i:nil="true"/>
<IsEditable>false</IsEditable>
<IsDiscountable>true</IsDiscountable>
<Info>
<Info>
<TypeId>209</TypeId>
<Value/>
<Code>bit_size</Code>
</Info>
<Info>
<TypeId>241</TypeId>
<Value/>
<Code>bit_del_time</Code>
</Info>
<Info>
<TypeId>95</TypeId>
<Value/>
<Code>bit_additionalinformation</Code>
</Info>
</Info>
<OptionalItems/>
<OnHandValue>12.000</OnHandValue>
<IncomingValue>0.000</IncomingValue>
<NextDeliveryDate i:nil="true"/>
<LeadtimeDayCount>0</LeadtimeDayCount>
<PromotionIdSeed/>
<ImageKey i:nil="true"/>
<ManufacturerName>Husqvarna</ManufacturerName>
<CategoryId>41722</CategoryId>
<OnHand xmlns:a="Enferno.Services.Contracts.Expose.Products">
<a:Value>12.000</a:Value>
<a:IncomingValue>0.000</a:IncomingValue>
<a:NextDeliveryDate i:nil="true"/>
<a:LeadtimeDayCount>0</a:LeadtimeDayCount>
<a:LastChecked i:nil="true"/>
<a:IsActive>true</a:IsActive>
<a:IsReturnable>true</a:IsReturnable>
<a:Info i:nil="true" xmlns:b="Enferno.Services.Contracts.Expose"/>
</OnHand>
<OnHandSupplier xmlns:a="Enferno.Services.Contracts.Expose.Products">
<a:Value>133.000</a:Value>
<a:IncomingValue>0.000</a:IncomingValue>
<a:NextDeliveryDate i:nil="true"/>
<a:LeadtimeDayCount>5</a:LeadtimeDayCount>
<a:LastChecked>2017-02-14T16:19:15.163</a:LastChecked>
<a:IsActive>true</a:IsActive>
<a:IsReturnable>true</a:IsReturnable>
<a:Info i:nil="true" xmlns:b="Enferno.Services.Contracts.Expose"/>
</OnHandSupplier>
<PriceRecommended i:nil="true"/>
<ManufacturerId>1685</ManufacturerId>
<UniqueName>underhallskit-motorsag</UniqueName>
<StatusId>1</StatusId>
<StockDisplayBreakPoint i:nil="true"/>
<PriceCatalog i:nil="true"/>
<IsBuyable>true</IsBuyable>
<SubDescription i:nil="true"/>
<CategoryIdSeed>41722</CategoryIdSeed>
<RecommendedQuantity>1.000</RecommendedQuantity>
<IsRecommendedQuantityFixed>false</IsRecommendedQuantityFixed>
<AppliedPromotions/>
<RequirementPromotionIdSeed/>
<IsSubscribable>false</IsSubscribable>
<DescriptionHeader i:nil="true"/>
<IsPriceManual>false</IsPriceManual>
<PriceStandard>0.00</PriceStandard>
<EanCode>345345345345345</EanCode>
<CostUnit>0.00</CostUnit>
<PriceDisplayIncVat>139.00</PriceDisplayIncVat>
</BasketItem>
</Items>
<Info>
<Info>
<TypeId>169</TypeId>
<Value/>
<Code>bit_expecteddeliverydate</Code>
</Info>
<Info>
<TypeId>293</TypeId>
<Value/>
<Code>bit_additionalorderinfo</Code>
</Info>
<Info>
<TypeId>445</TypeId>
<Value/>
<Code>Norce_Gender</Code>
</Info>
<Info>
<TypeId>493</TypeId>
<Value/>
<Code>recurring</Code>
</Info>
</Info>
<Summary>
<Items>
<Amount>5854.40</Amount>
<Vat>1463.60</Vat>
<AmountIncVat>7318.00</AmountIncVat>
</Items>
<Freigt>
<Amount>0.00</Amount>
<Vat>0.00</Vat>
<AmountIncVat>0.00</AmountIncVat>
</Freigt>
<Fees>
<Amount>0.00</Amount>
<Vat>0.00</Vat>
<AmountIncVat>0.00</AmountIncVat>
</Fees>
<Total>
<Amount>5854.40</Amount>
<Vat>1463.60</Vat>
<AmountIncVat>7318.00</AmountIncVat>
</Total>
</Summary>
<AppliedPromotions>
<Promotion>
<Id>5093</Id>
<Name>Add service</Name>
<Header/>
<ShortDescription/>
<Description1/>
<Description2/>
<StartDate i:nil="true"/>
<EndDate i:nil="true"/>
<ImageKey i:nil="true"/>
<RequirementSeed>3</RequirementSeed>
<DiscountCode i:nil="true"/>
<IsExcludedFromPriceCalculation>false</IsExcludedFromPriceCalculation>
<AllowProductListing>false</AllowProductListing>
<Images xmlns:a="Enferno.Services.Contracts.Expose"/>
<ProductFilters>
<Filter>
<ManufacturerId i:nil="true"/>
<CategorySeed i:nil="true"/>
<TypeId i:nil="true"/>
<ProductId i:nil="true"/>
<VariantProductId i:nil="true"/>
<PartNo>PRD0001274</PartNo>
<PricelistId>1</PricelistId>
<FlagId i:nil="true"/>
</Filter>
<Filter>
<ManufacturerId i:nil="true"/>
<CategorySeed i:nil="true"/>
<TypeId i:nil="true"/>
<ProductId i:nil="true"/>
<VariantProductId i:nil="true"/>
<PartNo i:nil="true"/>
<PricelistId i:nil="true"/>
<FlagId>1884</FlagId>
</Filter>
</ProductFilters>
<AppliedAmount>0.00</AppliedAmount>
<EffectSeed>5</EffectSeed>
<FreightDiscountPct i:nil="true"/>
<IsStackable>true</IsStackable>
<AppliedAmountIncVat>0.00</AppliedAmountIncVat>
</Promotion>
</AppliedPromotions>
<IpAddress>151.236.200.213</IpAddress>
<AttestedBy i:nil="true"/>
<TypeId>1</TypeId>
<DoHold>false</DoHold>
<IsBuyable>true</IsBuyable>
<InvoiceReference i:nil="true"/>
<PaymentMethodId i:nil="true"/>
<DeliveryMethodId>1</DeliveryMethodId>
<SalesAreaId>1</SalesAreaId>
</Basket>
Basket Model Overview:
The basket contains many properties. Key elements include identifiers, status, currency, editability, summary, and a collection of items. Each item represents a product added to the basket and contains its own set of properties.
- Id: Unique identifier for the basket. Typically stored in a persisted cookie for the active visitor.
- Status: Indicates the current state of the basket (e.g., "Basket", "Ready for payment", "Order").
- Currency: The currency used for the basket. If multiple currencies are supported, prices are converted accordingly.
- IsEditable / IsBuyable: Flags indicating if the basket can be updated or checked out.
- Summary: Contains total amounts and freight information.
- Items: List of products in the basket. Each item includes:
- Id: Basket item identifier (required for updates)
- LineNo: Row number
- ParentLineNo: For grouping or complex items
- ProductId / PartNo: Product identifiers
- Type: Product type
- PriceDisplay: Read-only price
- Quantity: Number of items
- PriceListId: Source price list
- IsEditable: Whether the item can be updated
Tip: Norce Commerce handles much of the basket business logic automatically. For example, adding an existing item creates a new line rather than incrementing quantity. You can implement custom logic in your own backend service layer if needed.
Update Workflow:
Whenever a change is made to the basket, Norce Commerce Shopping Service returns the entire updated basket object. A recommended practice is to cache the basket locally, or fetch it before making changes if concurrency is a concern.
Typical Update Steps:
- User action triggers a change.
- Fetch the current basket (from Norce or local cache).
- Apply changes to the basket or basket item.
- Call the relevant update API (e.g.,
UpdateBasket
,UpdateBasketItem
). - Receive the updated basket from Norce.
- Update your cache and return the new basket to the frontend.
Note: The basket can change due to external factors (e.g., product becomes unavailable, promotion ends). Your application should handle such scenarios gracefully.
When making basket API calls, always include relevant context such as pricelistSeed
, cultureCode
, and currencyId
if your application uses them. For logged-in users, set createdBy
to the user ID; for guests, use 1
.
A basket is created using the CreateBasket
method, typically when the first item is added. Include CustomerId
, CompanyId
, and default payment/delivery methods for logged-in users to streamline checkout.
There are several methods to add items:
- InsertBasketItem: Adds a single item as new row.
- InsertBasketItems: Adds multiple items as new rows.
- InsertBasketItemWithChildren: Adds a parent item with child items (for complex products).
- UpdateBasketItem: Can increment quantity on an existing item (requires you to resolve the item first).
RecommendedQuantity:
Check theRecommendedQuantity
field when adding items. IfIsRecommendedQuantityFixed
is true, only multiples ofRecommendedQuantity
are allowed.
Add existing item InsertBasketItem will always create a new row, if you want to update quantity instead, you need to make that validation on your client code first.
- UpdateBasket2: Updates basket-level information (e.g., status, comments).
- UpdateBasketItem / UpdateBasketItems: Updates item-level information (e.g., quantity, comment, price). The
Id
field is required for updates.
- DeleteBasketItem: Removes a specific item.
- UpdateBasketItem: Setting quantity to 0 removes the item.
- ClearBasket: Removes all items.
Note: Setting quantity to 0 via
UpdateBasketItem
is equivalent to deleting the item.
To manually override the calculated price (e.g., for quotations or special offers), set the Price
field and IsPriceManual: true
when adding or updating an item.
{
"PartNo": "TestPartNo",
"Price": 160.00,
"Quantity": 1.000,
"Comment": "Manual price for new basket row",
"PriceListId": 1,
"IsPriceManual": true
}
Note: The
Price
field is the unit price. After update, checkIsPriceManual
to identify manual prices.
To force a specific price list (e.g., for agreements or warehouse reservations), set PriceListLocked: true
on the basket item.
{
"PartNo": "TestPartNo",
"Quantity": 1.000,
"Comment": "Lock price list for this row",
"PriceListId": 15320,
"PriceListLocked": true
}
Note:
PriceListLocked
may revert to false if the price list is no longer active or after certain updates.
You can implement additional restrictions for when a basket is buyable, such as requiring all products to be in stock.
public bool Buyable(Basket basket)
{
if (basket.isBuyable) {
// Add custom logic here (e.g., check stock)
return true;
}
return false;
}
You may want to simplify basket handling for your application, such as:
- Automatically adding items with
RecommendedQuantity
- Incrementing quantity for existing items
- Handling flagged products differently
- Managing manual price overrides
If you need additional fields, map them as info types in Norce Commerce and extend your local basket model accordingly.
Promotions are applied automatically if requirements are met. All applied promotions are listed in the AppliedPromotions
field on the basket and on individual items.
- To apply a promotion code, use
UpdateBasket
and set theDiscountCode
property. - If the code is invalid, the basket will not show a discount code after update.
Multiple DiscountCodes Add multiple discount codes after eachother to the
DiscountCode
field, comma separated like so:Discount1,Discount2
If you want to create complex items (e.g., like bundles) use the ParentLineNo
field to group related items. Use:
- InsertBasketItemWithChildren: To add a parent and its children (the first item will be the parent).
- UpdateBasketItemQuantityWithChildren: To update quantities for parent and children together.
This works well if you want to group products together dynamically. Use Norce's product types for a stricter bundle solution but with more functionality in Norce.
Bundle product types Bundle product types will automatically get their child items into the basket, do not use the methods above.