Variants

What's a Variant?

This is how we are able to send up information about a customized item. Sugar in your coffee? Extra bacon? No anchovies? Put through your order with variants to remark your item and also as a method for adding a surcharge.

Note that unlike absolute type Surcounts, Variant amounts are multiplied by the quantity.

Examples

A Pepperoni Pizza with extra pepperoni, and an additional surcharge for adding toppings.

In this example, 200 cents is added to the items' totalBeforeSurcounts field from the extra_pepperoni variant price. Then afterward the custom_toppings_fee (100 cent) from surcounts is added also.


...
"items": [
  {
    "posId": "pep_pizza",
    "name": "Pepperoni Pizza",
    "quantity": 1,
    "description": "Homemade and spicy",
    "unitPrice": "1100",
    "totalBeforeSurcounts": "1300",
    "totalAfterSurcounts": "1400",
    "options": [
      {
        "name": "Extra Toppings",
        "posId": "extra_toppings",
        "variants": [
          {
            "name": "Extra Pepperoni",
            "posId": "extra_pepperoni",
            "price": 200
          }
        ]
      }
    ],
    "surcounts": [
      {
        "name": "Custom Toppings Fee",
        "amount": "100",
        "type": "absolute",
        "posId": "custom_toppings_fee",
        "value": 100
      }
    ]
  }
],
...

To kick it up a notch, here's the same example, but with a quantity of 2 instead of 1. Notice how the variant price is multiplied, while the surcount is not.


...
"items": [
  {
    "posId": "pep_pizza",
    "name": "Pepperoni Pizza",
    "quantity": 2,
    "description": "Homemade and spicy",
    "unitPrice": "1100",
    "totalBeforeSurcounts": "2600",
    "totalAfterSurcounts": "2700",
    "options": [
      {
        "name": "Extra Toppings",
        "posId": "extra_toppings",
        "variants": [
          {
            "name": "Extra Pepperoni",
            "posId": "extra_pepperoni",
            "price": 200
          }
        ]
      }
    ],
    "surcounts": [
      {
        "name": "Custom Toppings Fee",
        "amount": "100",
        "type": "absolute",
        "posId": "custom_toppings_fee",
        "value": 100
      }
    ]
  }
],
...