How to understand discount_applications and discount_codes in Order object?

lewen
Tourist
4 0 1
  "discount_applications": {
    "discount_applications": [
      {
        "type": "manual",
        "title": "custom discount",
        "value": "2.0",
        "value_type": "fixed_amount",
        "description": "customer deserved it",
        "target_type": "line_item",
        "target_selection": "explicit",
        "allocation_method": "across"
      },
      {
        "type": "script",
        "value": "5.0",
        "value_type": "fixed_amount",
        "description": "my scripted discount",
        "target_type": "shipping_line",
        "target_selection": "explicit",
        "allocation_method": "across"
      },
      {
        "code": "SUMMERSALE",
        "type": "discount_code",
        "value": "10.0",
        "value_type": "fixed_amount",
        "target_type": "line_item",
        "target_selection": "all",
        "allocation_method": "across"
      }
    ]
  },
  "discount_codes": [
    {
      "code": "SPRING30",
      "type": "fixed_amount",
      "amount": "30.00"
    }
  ],

This code is part of an order object in link https://shopify.dev/api/admin-rest/2021-10/resources/order#resource_object 

I have some questions about this:

1. Can I have more than one discount_application on one order? The filed discount_applications is an array.

2. There are 3 types, manual and script and discount_code. How do I generate these discounts? When a customer input a code in checkout page, which discount will generate?

3. What is the difference between discount_applications and discount_codes?

Replies 0 (0)