> For the complete documentation index, see [llms.txt](https://help.daasity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.daasity.com/technical-docs/transform-code/transform-code/order-status-code.md).

# Order Status Code

This page provides detailed instructions on the Order Status Code transform code block and what should be added to the Script Manifest file in order to execute the code

## Script Manifest File (YML) <a href="#script-manifest-file-yml" id="script-manifest-file-yml"></a>

### Upstream Transformation Dependencies <a href="#upstream-transformation-dependencies" id="upstream-transformation-dependencies"></a>

{% hint style="danger" %}
This block is dependent on the following blocks being implemented:

* Initialization
* UOS
  {% endhint %}

### Transformation Code Requirements <a href="#transformation-code-requirements" id="transformation-code-requirements"></a>

The following code should be added to the main workflow in the appropriate position, after Google Analytics and before Order Channel and Marketing per the [Transform Code Sequence - DRP](/technical-docs/transform-code/transform-code/transform-code-sequence-drp.md) page

```
  #--------------------------------------------------------------------------------------------------------------------
  # SECTION: 2700_ORDER_STATUS
  # DEPENDENCIES:
  #   - Section: 0500_UOS
  # OPTIONAL:
  #   - Integration: Recharge if tagging subscription orders is needed
  # REQUIRED: No
  # PURPOSE: This code creates the DRP tables for order status and order business unit and should be turned on once
  # UOS is enabled
  #--------------------------------------------------------------------------------------------------------------------
  order_status:
    integrations:
      - shopify
      - amazon_seller_central
      - skubana
      - lightspeed
    scripts:
      - "github://platform-sql-shared/scripts/base/2700_order_status/2700_OST_BAS_orders_to_update.sql"
      - "github://platform-sql-shared/scripts/base/2700_order_status/2700_OST_BAS_order_status.sql"
      - "github://platform-sql-shared/scripts/base/2700_order_status/2710_OST_BAS_order_business_unit.sql"

  order_status_subscriptions:
    integrations:
      - recharge
    scripts:
      - "github://platform-sql-shared/scripts/base/2700_order_status/2701_OST_BAS_order_status_subscription_flag.sql"
```

### Order Status

{% hint style="success" %}
Add this code to create the \[`drp.order_status`] and \[`drp.order_business_unit`] tables to help identify the status and source of orders
{% endhint %}

This script determines what orders need to be updated and is used to drive a incremental approach to updates reducing CPU utilization for refreshing data.  We recommend that this code is always turned on

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/2700_order_status/2700_OST_BAS_orders_to_update.sql>

These scripts create the two tables in this section of the data model

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/2700_order_status/2700_OST_BAS_order_status.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/2700_order_status/2710_OST_BAS_order_business_unit.sql>

{% hint style="info" %}
This code is only needed if you have Recharge and would like to include a flag to identify which orders are subscription orders
{% endhint %}

This script updates the \[`drp.order_status`] table and flags orders that are in Recharge

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/2700_order_status/2701_OST_BAS_order_status_subscription_flag.sql>
