Schemas / Commerce

rig.commerce.discount

v0.31.0 · draft 5 fields 1 required

Fields

FieldTypeMeaning
kind enumpercent · amount required percent or amount
percent number0 – 100 optional Optional. 0-100; 10 means 10%. Use when kind is percent
amount float optional Optional. Money off, major-currency. Use when kind is amount
currency string optional Optional. ISO 4217 of amount; omit on a percent discount
code string optional Optional. Promo / voucher code as printed

Adjustment on an offer. Format when present.

Field meanings follow schema.org discount / PriceSpecification reduction. This schema is the adjustment - not the resulting price and not a promotions engine.

kind is required. Do not fill both percent and amount. Do not write the sale price here - compose rig.commerce.price for the list amount and let a host apply this adjustment.

Compose onto the rig.commerce.offer entity. A second discount is another offer entity.

JSON Schema

Resolves at https://rig.works/schemas/rig.commerce.discount.schema.jsonraw file.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rig.works/schemas/rig.commerce.discount.schema.json",
  "title": "rig.commerce.discount",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "percent",
        "amount"
      ]
    },
    "percent": {
      "type": "number",
      "minimum": 0,
      "maximum": 100
    },
    "amount": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$",
      "description": "ISO 4217 (ISO 20022 Ccy)."
    },
    "code": {
      "$ref": "./_defs.schema.json#/$defs/string"
    }
  },
  "required": [
    "kind"
  ],
  "description": "Adjustment on an offer. percent is 0–100 (10 means 10%). amount is money off, not the resulting price. schema.org Discount / PriceSpecification."
}

Seen in

commerce-offer.json