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
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": "a092d936122f3c38d33da09a",
"type": "type",
"value": 30.7,
"amount": 29.99,
"creditNoteRef": "e1228dc8afea179c784dd7af"
}
Response
{
"orderAddDiscount": {
"_id": "e9615f0c20a2146c40fe8046",
"id": "example",
"incId": 42,
"origin": "example",
"created": 1751354728256,
"modified": 1755354253035,
"shipping": {
"status": "Pending",
"fulfilled": true,
"date": 1754944856342,
"method": "example",
"freeShippingThreshold": 1.23,
"tracking": "example",
"shopCollection": true,
"weight": 1.23,
"packingSlip": "example"
},
"billing": {
"status": "example",
"fulfilled": true,
"paymentDate": 1753330764986,
"refundDate": 1763984229138
},
"orderId": "example",
"notes": [
{
"date": 1727960144181,
"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": "4e98e6f167f13ae17f9d30c0",
"quantity": 1,
"unavailable": true,
"added": 1761810543894
}
],
"messages": [
{
"_id": "56065d17eb10588c877cc6af",
"created": 1733557463515,
"subject": "example",
"message": "example",
"fromBuyer": true,
"flagged": 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": "b2e6673179d0e1d9697eabaf",
"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": 1771274072348,
"ip": "example"
}
],
"seller": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "cda11ffa2dccd6852973641f"
},
"updated": 1764213481417,
"status": "example",
"discogsStatus": "example",
"buyerWasContacted": true,
"unreadMessagesCount": 42,
"mergeableOrders": [
{
"_id": "676c567f15d7a1517f512aa1",
"id": "example",
"created": 1775863173923,
"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. |