Addon Order Item Configuration

This document describes the technical integration details, configuration requirements, validation rules, and runtime behaviors required to successfully implement and operate the Addon Order feature.

1. Objective

The Addon Order feature enables the creation of a new supplementary order that is explicitly linked to an existing main order.

Key characteristics:

  • The addon order:

    • Is created as a separate order

    • Is linked to the original order

    • Continues with the same segment information


2. Activation

The addon order flow is controlled by a dynamic configuration flag.

Required Dynamic Setting:

ADDON_BASKET_ENABLED = True

Behavior:

  • When set to True:

    • Addon basket creation is allowed

    • /orders/create-addon-order/ endpoint becomes functional

  • When set to False:

    • Addon basket creation is blocked

    • Requests fail with a validation error (order_addon_100_5)

    • HTTP status code: 406 Not Acceptable


3. Basket Namespace Configuration

Addon orders operate under a dedicated basket namespace.

Because of this, the default basket validation rules must be adjusted.

Removing the Null Namespace Validator

To enable addon basket namespaces, the following validator must be removed from BASKET_NAMESPACE_VALIDATORS:

Preventing Invalid or Conflicting Namespaces

To avoid namespace collisions or invalid namespace creation, the following validator must be added:

Enforcing Addon-Only Basket Creation (Optional)

If the business requires that only addon baskets can be created, the following validator can be enabled:

Behavior when enabled:

  • Basket creation under non-addon namespaces is blocked


4. Addon Order Creation API

Endpoint

Example Request

Runtime Behavior

  • If an active addon basket already exists for the order:

    • The system returns the existing basket

  • If no active addon basket exists:

    • A new addon basket is created

  • The addon basket is:

    • Marked as the main (active) basket

    • Assigned a namespace in the format:

If the addon basket is no longer required, the active basket can be changed via standard basket namespace endpoints.

Response Scenarios

Existing Addon Basket

New Addon Basket Created

Validation Rules

Addon order creation is subject to the following validations.

User Authentication Validation

Error Code: order_addon_100_1

  • Only authenticated (logged-in) users can create addon orders

  • Guest users are explicitly blocked

Order Ownership Validation

Error Code: order_addon_100_2

  • The requesting user must be the owner of the order

  • Users cannot create addon orders for orders they do not own

Order Type Validation

Error Code: order_addon_100_7

  • Only orders with regular type are eligible

  • Other order types are rejected

Order Status Validation

Error Code: order_addon_100_3

Addon orders are allowed only if the main order status is one of:

  • waiting

  • payment_waiting

  • confirmation_waiting

  • approved

All other statuses are invalid for addon order creation.

Feature Toggle Validation

Error Code: order_addon_100_5

  • Triggered when ADDON_BASKET_ENABLED is not True

  • Response:

    • HTTP Status: 406

    • Addon basket creation is blocked

Example Error Response:


5. Addon Basket Expiration Handling

While operating on an addon basket, the main order status is continuously validated.

Expiration Conditions

  • If the main order transitions into a status that no longer allows addon orders:

    • The addon basket is marked as expired

System Response

  • HTTP Status: 410 Gone

  • Basket items are returned for reference

  • User is instructed to create a new order


6. Checkout Flow Adjustments

Addon orders reuse the standard checkout flow with mandatory exclusions.

Skipped Steps

  1. The following checkout pages must be skipped:

    1. Address Selection Page

    2. Shipping Option Selection Page

  2. Standard post-order pages are reused

  3. Shipping amount is automatically set to 0 by the system

7. Dynamic Settings and Rule Bypass

During the addon order process, some dynamic configurations are not triggered again.

  • The IDENTITY_NUMBER_REQUIRED_AMOUNT configuration is not re-evaluated for addon orders.

  • Shipping option rules are not re-applied during the addon order stage.

Therefore, these configurations and rules are applied only to the initial (main) order and remain valid for the addon order without being recalculated.


8. Frontend Identification of Addon Basket

To enable frontend distinction, the basket response includes a status field.

Example Response

Therefore, frontend can:

  • Detect addon basket

  • Adjust UI and flow accordingly

  • Prevent invalid actions


9. Newly Created Addon Order Properties

When checkout is completed:

  • A new order is created with:

    • order_type = addon

    • related_order referencing the main order

Last updated

Was this helpful?