Here we have the option to add a product to the cart on Backoffice
Table of contents
Table of contentsGlossaryPUT - add configurable product to cartPUT - add product to cartPOST - change product lines prices
Glossary
Name | Explanation |
cartId | identifier of cart |
productId | identifier of product |
quantity β type
value | possible to choose "CONTENT_QUANTITY" or "ORDER_QUANTITYβ. Content quantity is the quantity of the product, while order quantity adds the quantity with the sales unit
amount of products |
configurableProducts | Multiple configurable products can be added at once to speed up communication. |
configurableProducts β children
allowQuantityChange
allowQuantitySplitting
productId
removable
externalId | Children lines are shown below parent line. It can by an empty list.
If set to false quantity editing is blocked for this line. True by default.
Set to false will prevent this line from being split to different shipments. For example if splitting by availability either whole line will end up 'available products' shipment, or whole line will end up in 'not available products' shipment, without possibility of it ending up partially in both. True by default
Id (sku) of product in this line
If set to false, this line won't be removable from cart. This is safe to set for children to prevent changing composition of the group of products - if main line is removed children are removed along with it anyway. True by default
externalId will allow updating this product using it. Currently it is ignored. |
children β quantity
type |
Possible to choose: " CONTENT_QUANTITY " "ORDER_QUANTITY β. For example - CONTENT_QUANTITY is a pack of nails, ORDER_QUANTITY is single nail |
children β main
allowQuantityChange
allowQuantitySplitting
productId
removable |
If set to false quantity editing is blocked for this line. True by default.
Set to false will prevent this line from being split to different shipments. For example if splitting by availability either whole line will end up 'available products' shipment, or whole line will end up in 'not available products' shipment, without possibility of it ending up partially in both. True by default
Id (sku) of product in this line
If set to false, this line won't be removable from cart. This is safe to set for children to prevent changing composition of the group of products - if main line is removed children are removed along with it anyway. True by default |
operatorId | Id of backoffice operator on behalf who the products are added. |
prices β property name (additional property) | |
property name (additional property) β purchasePrice
value |
number of value |
property name (additional property) β salePrice
value |
number of value |
property name (additional property) β change
field
value |
possible to choose: FIXED_DISCOUNT " "PERCENT_DISCOUNT " "FIXED_MARGIN " "PERCENT_MARGIN " "FIXED_PRICE " "PURCHASE_PRICE β
number of value |
PUT - add configurable product to cart
In order to add configurable product to cart use PUT
/api/v1/orderpath/integrations/auth-required/carts/{cartId}/add-configurable-products
using cart identifier.The sequence diagram below shows the process: Use the parameter in query below to add configurable product to cart:
cartId
Example request:
jsoncurl -X PUT "https://api-preprod.one.unity.pl/api/v1/orderpath/integrations/auth-required/carts/c2c25ae9-dbcf-43bb-9626-ee1f5ae174ea/add-configurable-products" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -d " { "configurableProducts": [ { "children": [ { "allowQuantityChange": true, "allowQuantitySplitting": true, "productId": "8", -- required "quantity": { -- required "type": "CONTENT_QUANTITY", -- required "value": 4 -- required }, "removable": false }, { "allowQuantityChange": true, "allowQuantitySplitting": true, "productId": "7", "quantity": { "type": "CONTENT_QUANTITY", "value": 4 }, "removable": false } ], "externalId": "123123", "main": { -- required "allowQuantityChange": true, "allowQuantitySplitting": true, "productId": "9", -- required "quantity": { -- required "type": "CONTENT_QUANTITY", -- required "value": 2 -- required }, "removable": false } } ], "operatorId": "a11efeb9-4e8b-4430-aca0-e361f5c63e43" }
PUT - add product to cart
In order to add product to cart use PUT
/api/v1/orderpath/integrations/auth-required/carts/{cartId}/add-product
using cart identifier.The sequence diagram below shows the process: Use the parameter in query below to add product to cart:
cartId
Example request:
jsoncurl -X PUT "https://https://api-preprod.one.unity.pl/api/v1/orderpath/integrations/auth-required/carts/26473d08-8f42-4e23-97c6-ec5675401a87/add-product" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -d " { "productId": "product_2607", -- required "quantity": { "type": "CONTENT_QUANTITY", -- required "value": 10 -- required } }
POST - change product lines prices
In order to change product lines prices use POST
/api/v1/orderpath/integrations/auth-required/carts/{cartId}/products/change-price
. The diagram below shows the dependency of communicating with the API:Example request:
jsoncurl -X POST "https://api-preprod.one.unity.pl/api/v1/orderpath/integrations/auth-required/carts/4175c9a2-7e4a-4e57-b1ba-c559bdf88e44/products/change-price" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -H "Content-Type: application/json" -d " { "prices": { -- required "63e70763-4e6d-40b3-bb7a-ae0e71be33e6": { -- additional property "purchasePrice": 80, -- required if use additional property "salePrice": 200, -- required if use additional property "change": { "field": "FIXED_DISCOUNT", -- required if use change "value": 50 -- required if use change } } }, "operatorId": "a11efeb9-4e8b-4430-aca0-e361f5c63e43" }