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": "ce20a18b4c775216f4ead526",
"type": "type",
"value": 30.7,
"amount": 29.99,
"creditNoteRef": "a72771842c059e1270d3bce5"
}
Response
{
"orderAddDiscount": {
"_id": "1231d9a5199cbdec73afc2ca",
"id": "example",
"incId": 42,
"origin": "example",
"created": 1775842574531,
"modified": 1778127659034,
"shipping": {
"status": "Pending",
"fulfilled": true,
"date": 1767718329823,
"method": "example",
"freeShippingThreshold": 1.23,
"tracking": "example",
"shopCollection": true,
"weight": 1.23,
"packingSlip": "example"
},
"billing": {
"status": "example",
"fulfilled": true,
"paymentDate": 1792467967316,
"refundDate": 1764380074366
},
"orderId": "example",
"notes": [
{
"date": 1768015550343,
"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": "dc575caa6dcb1d4239e6f90d",
"quantity": 1,
"unavailable": true,
"added": 1767546580508
}
],
"messages": [
{
"_id": "82f079803eb9afe729f56a61",
"created": 1786681386647,
"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": "dbaf7bc24b8e99d384d5d93b",
"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": 1785847565959,
"ip": "example"
}
],
"seller": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "39b816018519fdfea60b3a2e"
},
"updated": 1752031172226,
"status": "example",
"discogsStatus": "example",
"buyerWasContacted": true,
"unreadMessagesCount": 42,
"mergeableOrders": [
{
"_id": "4b1209b00474fd10df280738",
"id": "example",
"created": 1749797469412,
"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. |