orderAddDiscount Mutation
Description
Adds a discount or credit note to an order.
mutation orderAddDiscount(
$orderRef: ID!
$type: String!
$value: Float
$amount: Float
$creditNoteRef: ID
) {
orderAddDiscount(
orderRef: $orderRef
type: $type
value: $value
amount: $amount
creditNoteRef: $creditNoteRef
) {
_id
id
incId
origin
created
modified
shipping {
status
fulfilled
date
method
freeShippingThreshold
tracking
shopCollection
weight
packingSlip
}
billing {
status
fulfilled
paymentDate
refundDate
}
orderId
notes {
date
content
}
instructions
totals {
subtotal
subtotalBeforeTaxes
tax
grand
leftToPay
itemQuantity
discount
shipping
creditNote
balance
}
items {
_id
quantity
unavailable
added
}
messages {
_id
created
subject
message
fromBuyer
flagged
archived
isSystem
content
read
orderId
orderIncId
uri
via
}
buyer {
_id
firstName
lastName
email
name
path
telephone
organisation
taxNumber
}
logs {
action
description
date
ip
}
seller {
type
name
email
ref
}
updated
status
discogsStatus
buyerWasContacted
unreadMessagesCount
mergeableOrders {
_id
id
created
total
description
}
path
}
}
Variables
{
"orderRef": "a8ce3518c3c21d287fe22e77",
"type": "type",
"value": 30.7,
"amount": 29.99,
"creditNoteRef": "e18b43901637375f51875098"
}
Response
{
"orderAddDiscount": {
"_id": "71405d394bdb7b4a6dc521ec",
"id": "example",
"incId": 42,
"origin": "example",
"created": 1744753346825,
"modified": 1743986502751,
"shipping": {
"status": "Pending",
"fulfilled": true,
"date": 1745339611254,
"method": "example",
"freeShippingThreshold": 1.23,
"tracking": "example",
"shopCollection": true,
"weight": 1.23,
"packingSlip": "example"
},
"billing": {
"status": "example",
"fulfilled": true,
"paymentDate": 1744944133808,
"refundDate": 1746429820526
},
"orderId": "example",
"notes": [
{
"date": 1752886578830,
"content": "example"
}
],
"instructions": "example",
"totals": {
"subtotal": 1.23,
"subtotalBeforeTaxes": 1.23,
"tax": 1.23,
"grand": 1.23,
"leftToPay": 1.23,
"itemQuantity": 1.23,
"discount": 0.1,
"shipping": 1.23,
"creditNote": 1.23,
"balance": 1.23
},
"items": [
{
"_id": "9b8967ea81264fe54e301a87",
"quantity": 1,
"unavailable": true,
"added": 1785598466865
}
],
"messages": [
{
"_id": "e1a46e9191d3fa06b9e553f5",
"created": 1775323846542,
"subject": "example",
"message": "example",
"fromBuyer": true,
"flagged": true,
"archived": true,
"isSystem": true,
"content": "example",
"read": true,
"orderId": "example",
"orderIncId": 42,
"uri": "https://www.my-common-ground-store.com/release/1763553751/release-artist-release-name",
"via": "example"
}
],
"buyer": {
"_id": "6203ade0e05b6cdfecba5e1b",
"firstName": "example",
"lastName": "example",
"email": "email@example.com",
"name": "example",
"path": "/release/1763553751/release-artist-release-name",
"telephone": "example",
"organisation": "example",
"taxNumber": "example"
},
"logs": [
{
"action": "example",
"description": "example",
"date": 1741023392262,
"ip": "example"
}
],
"seller": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "0e248cc0fe08e2ecb3e2c344"
},
"updated": 1777940982192,
"status": "example",
"discogsStatus": "example",
"buyerWasContacted": true,
"unreadMessagesCount": 42,
"mergeableOrders": [
{
"_id": "77495bce4b03f222a146ec93",
"id": "example",
"created": 1786300824863,
"total": 29.99,
"description": "example"
}
],
"path": "/release/1763553751/release-artist-release-name"
}
}
Arguments
| Name | Type | Description |
|---|---|---|
orderRef | ID! | Reference ID of the order. |
type | String! | Type of discount (e.g. "discount", "creditNote"). |
value | Float | Discount value (percentage or amount, depending on type). |
amount | Float | Amount to apply, used for credit notes. |
creditNoteRef | ID | Reference ID of the credit note to apply, when adding a credit note discount. |