Delete a specific price adjustment information from a given cart - Fabric

Delete a specific price adjustment information from a given cart

cURL

curl --request DELETE \
  --url https://prod.cart.fabric.inc/v2/carts/{cartId}/adjustments/{adjustmentId} \
  --header 'Authorization: <authorization>' \
  --header 'x-site-context: <x-site-context>'

Python

import requests

url = "https://prod.cart.fabric.inc/v2/carts/{cartId}/adjustments/{adjustmentId}"

headers = {
    "x-site-context": "<x-site-context>",
    "Authorization": "<authorization>"
}

response = requests.delete(url, headers=headers)

print(response.text)

JavaScript (Fetch)

const options = {
  method: 'DELETE',
  headers: {'x-site-context': '<x-site-context>', Authorization: '<authorization>'}
};

fetch('https://prod.cart.fabric.inc/v2/carts/{cartId}/adjustments/{adjustmentId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://prod.cart.fabric.inc/v2/carts/{cartId}/adjustments/{adjustmentId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => [
    "Authorization: <authorization>",
    "x-site-context: <x-site-context>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Go

package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {

url := "https://prod.cart.fabric.inc/v2/carts/{cartId}/adjustments/{adjustmentId}"

req, _ := http.NewRequest("DELETE", url, nil)

req.Header.Add("x-site-context", "<x-site-context>")
    req.Header.Add("Authorization", "<authorization>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}

Response Status Codes

JSON Example Response

{
  "items": [
    {
      "sku": "16B2GS8LD5FDS",
      "quantity": 1,
      "isPickup": true,
      "cartItemId": "88cded0f-1439-40eb-a7a0-167e8bffdb3b",
      "itemId": "1000000001",
      "title": "Varnet Garden Light Kit",
      "attributes": [
        {
          "attributeId": "60c2a358eb2ec30008ae70a1",
          "name": "gift wrapping (small)",
          "type": "GIFT",
          "price": 10,
          "description": "Gift wrapping for a small package",
          "value": "true"
        }
      ],
      "totalPrice": {
        "currency": "USD",
        "amount": 100,
        "discount": {
          "amount": 20
        }
      }
    }
  ],
  "currency": "USD",
  "totalItems": 1,
  "cartState": "PENDING",
  "customer": {
    "id": "d7e78a21-bee3-4448-bf1c-d5b5461dbda2",
    "type": "EMPLOYEE"
  }
}

Error Responses