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": "5c2d794f2652d75841e80ef1",
"type": "type",
"value": 30.7,
"amount": 29.99,
"creditNoteRef": "40e30e7e71c80eaae704aad1"
}
Response
{
"orderAddDiscount": {
"_id": "30517751b54d03e123e709ca",
"id": "example",
"incId": 42,
"origin": "example",
"created": 1772944005690,
"modified": 1733382072383,
"shipping": {
"status": "Pending",
"fulfilled": true,
"date": 1774091779402,
"method": "example",
"freeShippingThreshold": 1.23,
"tracking": "example",
"shopCollection": true,
"weight": 1.23,
"packingSlip": "example"
},
"billing": {
"status": "example",
"fulfilled": true,
"paymentDate": 1752403198393,
"refundDate": 1739005971571
},
"orderId": "example",
"notes": [
{
"date": 1790201022088,
"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": "0c7cab3d533805b9ee62d172",
"quantity": 1,
"unavailable": true,
"added": 1778307509739
}
],
"messages": [
{
"_id": "a4ba1ba2659de9a35f35b79f",
"created": 1746517217279,
"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": "95b845465ddd8fd1dec93999",
"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": 1768869536650,
"ip": "example"
}
],
"seller": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "a5745f4fdd0acdc4b767fb35"
},
"updated": 1789364390527,
"status": "example",
"discogsStatus": "example",
"buyerWasContacted": true,
"unreadMessagesCount": 42,
"mergeableOrders": [
{
"_id": "d219190bca4d210711c80042",
"id": "example",
"created": 1732240821920,
"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. |