Akinon Release Notes (05/12/2025) are now live! Click here to learn what's new.
LogoLogo
API Reference
  • Home
  • Quick Start
  • Tutorials
  • Technical Guides
  • Release Notes
  • Glossary
  • Welcome to Akinon Technical Guides
  • ACC
    • ACC CLI
    • Create Application via CLI
    • Deploy Environment Variables
    • App Store for Developers
  • Omnitron
    • Product Types
    • Product Categorization
    • Splitting a Merged Order Item
  • Commerce
    • Shipping Rules Calculator
    • Data Source Shipping Options
    • Attribute Based Shipping Options
    • Filtering Products
    • Conversation & Messages
    • Sitemap Configuration
    • Weight-Based Product Sales
    • Group Attribute Sets
    • Contract Management
    • Find in Store for Whippy Ware
    • Plugins
    • Remote Price
    • E-mail Templates
    • Loyalty Accounts
    • Search Structure
    • User Segmentation & Rules
    • Promotions
  • OMS
    • Getting Started with OMS
    • Basic Setup
    • Scenarios
    • Capacity Feature
    • Package Management
      • Packages
      • Transfer
      • States
    • Commands
      • Packages
        • Package Command Parameters
        • DeAllocate Package Reservations Command
        • Channel Based Complete Packaging without Shipment Command
        • Complete Packaging with Shipment Command
        • Complete Packaging without Shipment Command
        • Package Refuse with Denial Reason Command
        • Product Not Found & Wrong Product Command
        • Product Not Found & Wrong Product Command Advanced
        • Package Packed for Refund Command
        • Block The Package For Action Command
        • Unblock the Package For Action Command
        • Update The Package’s Invoice
        • Manual Planning Command
      • Transfer
        • Transfer Order Advanced Command
        • Product for Transfer Not Found & Wrong Product Command
        • Transfer Delivered Command
        • Transfer Dispatch Command
        • Transfer Ready for Dispatch Command
        • Transfer Out Of Stock
      • Shipment
        • Shipment Order Command
        • Package Advanced Shipment Command
        • Ship The Package Command
        • Ship The Package without Shipment Integration Command
        • Update The Package’s Shipment Status Command
        • Update Shipment Info of Package Command
    • Inventory Locations & Engine
      • Properties & Domain Relation
      • Customization
      • Inventory Engine
    • Fulfillment
      • Shipments
      • Invoice Integration
    • Webhooks
      • Webhook Examples
        • Order Webhook
        • Package Webhook
        • Shipment Webhook
        • Stock Location Webhook
        • Transfer Webhook
    • Integrating OMS with Seller Center
  • Instore
    • Getting Started
    • Cash Register Integration
    • OTP (One Time Password) Process
    • Services
      • Password Reset Services
  • Marketplace Dashboard
    • N11 Marketplace Setup Configurations
    • Trendyol Marketplace Setup Configurations
    • Walmart Marketplace Setup Configurations
    • Amazon Marketplace Setup Configurations
    • Hepsiburada Marketplace Setup Configurations
  • Project Zero
    • Django
      • Basic Setup
      • Project Structure
        • Templates & Components
        • Private Dependencies
        • Omnife Project Submodule
        • Webpack
        • ESLint Rules
        • Bundles
        • Multilanguage & Translation
        • Environmental File
        • Custom Error Pages
        • Icon Font
      • Page Types
        • Static Pages & Flatpages
        • Account Page
          • Template Rendering in Account Pages
          • Forms & Validation
        • Basket Page
          • Redux Basket State
          • Basket Page - View
        • Checkout
          • Redux Checkout State
          • View & Template Rendering
          • Masking & Validation
      • Theming & Styling
      • Widgets
      • SEO Management
      • Extending Project Zero
    • Next.js
      • Basic Setup
      • Deployment
      • Static Assets
      • Plugins
      • Widgets
      • Icons
      • Localization
      • SEO Management
      • Advanced Usage
      • Data Fetching
        • Client
          • Account
          • Address
          • Basket
          • Checkout
          • Misc
          • Product
          • User
          • Wishlist
        • Server
          • Category
          • Flat Page
          • List
          • Menu
          • Product
          • SEO
          • Special Page
          • Widget
  • App Maker
    • Setup Your Environment
    • Plugin Quickstart
    • Create Project
    • Setup Existing Project
    • Deploy Project
    • Users and Roles
    • Add Public Key
    • App Maker CLI
    • Create App on Stores
      • Creating App on Apple App Store
      • Creating App on Google Play Store
    • Mobile App Framework
      • Configuration
      • Framework
      • Project Structure
        • Structure
        • Data Containers
        • Pages
      • Dependency Integration
        • Plugins
        • Akinon Plugin Adapter
  • Akifast
    • HPP
      • Getting Started
      • Authorization
      • Payment Session Creation
        • Key Points Before Creating a Payment Session
        • Creating Payment Session
        • Redirecting to the Payment Page
        • Errors Encountered During Payment Session Creation
      • Merchant Services
        • Shipping Query URL
        • Agreement Query URL
        • Other URLs
  • B2B
    • Getting Started
    • B2B Setup
  • Adds-on
    • Invoicer
      • Introduction
      • Invoice & Pay On Delivery Service
  • Channel App Template
    • Introduction
    • Installation and Usage
    • Development Steps
      • Folder Structure
      • Starting Step
      • Encoding the Sales Channel
        • Introduction
        • Setup
        • Products
        • Product Price
        • Product Stock
        • Product Image
        • Orders
        • Product Data
      • Adding a New Command to Akinon
      • Listening for External Requests
    • Architecture
      • Introduction
      • Integration
      • Services (Flows)
        • Introduction
        • Product Service
        • Price Service
        • Stock Service
        • Image Service
        • Order Service
  • Multi Regional Settings
    • Multi Regional Settings
Powered by GitBook

© 2025 Akinon. All rights reserved.

On this page
  • Merged Order Item
  • Quantity Key in Order Item Attributes
  • Calculation in Merged Order Item
  • Splitting a Merged Order Item
  • POST Split Merged Order Item
  • Pre-Split State
  • Post-Split State
  • Proportional Value Distribution
  • Conditions for Splitting
  • Common Errors and Responses
  • Additional Errors During Split Operation

Was this helpful?

  1. Omnitron

Splitting a Merged Order Item

This document explains the concept, functionality, and API operations associated with the Merged Order Item in Omnitron. It provides details on quantity management, split operations, conditions, error handling, and related models.

Splitting a merged order item in Omnitron provides flexibility and precision in managing order quantities, particularly for scenarios involving order modifications, fulfillment adjustments, or customer requests. Below are examples of why someone might need to use this feature:

1. Order Amendments

Scenario:

A customer changes their mind and wants to cancel part of their order. For example, they ordered 5 units of a product but now want only 3.

Solution:

Split the merged order item into two:

  • One order item with a quantity of 3 (retained by the customer).

  • Another order item with a quantity of 2 (processed for cancellation).

2. Handling Returns or Replacements

Scenario:

A customer orders 6 units of a product, but 2 of the units are damaged and need replacement.

Solution:

Split the merged order item into two:

  • One order item with a quantity of 4 (undamaged units retained).

  • Another order item with a quantity of 2 (processed for return or replacement).

Merged Order Item

In Omnitron, each order item within an order is recorded with the quantity of the product. A single order item can represent multiple units of the same product. For example, if an order includes two units of the same product, one merged order item is created, and its quantity is recorded as 2.

Quantity Key in Order Item Attributes

The quantity is defined using a keyword stored in the attributes field of the order item. This keyword, known as ORDER_ITEM_QUANTITY_KEY, is dynamic and must be defined in the environment configuration file.

Example: If ORDER_ITEM_QUANTITY_KEY is defined as quantity:

"attributes": {
    "quantity": 4
}

Calculation in Merged Order Item

Order items that represent multiple units of a product are referred to as Merged Order Items. The values of fields like price, discount_amount, retail_price, and installment_interest_amount in a merged order item are calculated based on the total quantity.

Example Calculation:

For a merged order item, the price is calculated by multiplying the unit price by the total quantity:

  • Unit Price: 100₺

  • Quantity: 3

Total Price (price) = Unit Price × Quantity = 100 × 3 = 300₺

Splitting a Merged Order Item

A merged order item can be split into two order items based on the specified quantity. The first item is the updated version of the original order item, and the second is a new order item.

POST Split Merged Order Item

Path: api/v1/order_items/{pk}/split/

Example Request Body

The waiting_quantity field in the request body is used to specify the quantity of items that should be split from the original order item. This integer value determines the number of items to be extracted from the merged order item and moved into a new order item. The remaining quantity after the split will stay in the original order item, and its quantity field will be updated accordingly.

For example,

  • if the original order item has a quantity of 10,

  • and the waiting_quantity is set to 2, the split operation will create a new order item with a quantity of 2 while reducing the original order item's quantity to 8.

{
    "waiting_quantity": 2 <int>
}

The value of waiting_quantity must be less than the current quantity of the original order item.

Example Response

The example response illustrates the details of the newly created order item after a successful split operation. Key points of the response are as follows:

  • pk: This is the unique identifier (primary key) for the newly created order item. In this example, the new order item has the ID 2.

  • order: Indicates the associated order ID to which the new order item belongs. It remains the same as the original order item's order ID (3 in this example).

  • product: Specifies the ID of the product associated with the new order item. This value is inherited from the original order item and remains consistent (4 in this example).

  • attributes:

    • quantity: Reflects the waiting_quantity value provided in the request body. This shows the number of items included in the newly created order item (2 in this case).

{
    "pk": 2,
    "order": 3,
    "product": 4,
    "attributes": {
        "quantity": 2
    },
    ...
}

Pre-Split State

Path: api/v1/order_items/{pk}

Response Body

{
    "pk": 1,
    "attributes": {
        "quantity": 10
    },
    "price": "150.00",
    ...
}

Post-Split State

Path: api/v1/order_items/{pk}

Updated Original Order Item:

{
    "pk": 1,
    "attributes": {
        "quantity": 8
    },
    "price": "120.00",
    ...
}

New Order Item:

{
    "pk": 2,
    "attributes": {
        "quantity": 2
    },
    "price": "30.00",
    ...
}

Proportional Value Distribution

When a merged order item is split, fields like price, retail_price, and discount_amount are distributed proportionally.

Let’s assume we have an initial order item consisting of 3 products with the following details:

  • quantity: 3

  • price: 300 ₺

  • retail_price: 330 ₺

  • discount_amount: 30 ₺

  • installment_interest_amount: 15 ₺

When this order item is split into two new order items—one with 1 product and the other with 2 products—the values are distributed proportionally as follows:

1. New Order Item (1 Product)

  • quantity: 1

  • price: 100 ₺ (300 / 3 * 1)

  • retail_price: 110 ₺ (330 / 3 * 1)

  • discount_amount: 10 ₺ (30 / 3 * 1)

  • installment_interest_amount: 5 ₺ (15 / 3 * 1)

2. New Order Item (2 Products)

  • quantity: 2

  • price: 200 ₺ (300 / 3 * 2)

  • retail_price: 220 ₺ (330 / 3 * 2)

  • discount_amount: 20 ₺ (30 / 3 * 2)

  • installment_interest_amount: 10 ₺ (15 / 3 * 2)

Conditions for Splitting

The following conditions must be met for the split operation:

  1. ORDER_ITEM_QUANTITY_KEY must be defined in the environment file.

  2. The sales channel type of the order must be Web.

  3. The waiting_quantity must be less than the current quantity of the order item.

  4. The order item must not have an active Cancellation Plan. (Cancellation Plans with a status other than cancelled or rejected are considered active.)

  5. The order item must not have an active Cancellation Request. (Cancellation Requests with a status other than rejected are considered active.)

If any condition is not met, the operation is rolled back, and an error message is returned.

Common Errors and Responses

  1. ORDER_ITEM_QUANTITY_KEY not defined:

{
    "non_field_errors": "OrderItem couldn't be split, because it is not enabled. Please consult your administrator.",
    "error_code": "order_item_103_10"
}
  1. Channel type is not Web:

{
    "non_field_errors": "OrderItem: {pk} can not be split. Channel type must be 'Web'.",
    "error_code": "order_item_103_1"
}
  1. waiting_quantity is greater than or equal to the current quantity:

{
    "non_field_errors": "OrderItem: {pk} can not be split. waiting_quantity: {int} must be smaller than OrderItem {ORDER_ITEM_QUANTITY_KEY}: {int}.",
    "error_code": "order_item_103_2"
}
  1. Active Cancellation Plan exists:

{
    "non_field_errors": "OrderItem: {pk} can not be split. There is a Cancellation Plan with status {status} on OrderItem.",
    "error_code": "order_item_103_3"
}
  1. Active Cancellation Request exists:

{
    "non_field_errors": "OrderItem: {pk} can not be split. There is a Cancellation Request with status {status} on OrderItem.",
    "error_code": "order_item_103_4"
}

Additional Errors During Split Operation

If an error occurs during the split operation, the following error messages are provided to the user:

  1. When the total quantity of the resulting order items after the split does not equal the original quantity:

{
    "non_field_errors": "The initial Order Item {key} is not equal to the sum of the split Order Items {key}.",
    "error_code": "order_item_103_5"
}
  1. When the split operation is successful, but the request to update Commerce fails:

{
    "non_field_errors": "OrderItem: {pk} couldn't be split because it couldn't be updated on Commerce. Commerce error_message: {error}",
    "error_code": "order_item_103_6"
}
  1. When the split operation and the update request to Commerce are successful, but the newly created order item cannot be transmitted to Commerce:

{
    "non_field_errors": "OrderItem split operation is rolled back because split OrderItem couldn't be created on Commerce even though the OrderItem {} was updated on Commerce. Commerce error_message: {}",
    "error_code": "order_item_103_7"
}
  1. When an error occurs while updating the model records during the split operation:

{
    "non_field_errors": "OrderItem couldn't be split because of an error during the process of updating {model} fields. error_message: {error}",
    "error_code": "order_item_103_8"
}
  1. When an error occurs while splitting records related to the order item during the split operation:

{
    "non_field_errors": "OrderItem couldn't be split because of an error during the process of splitting {model}. error_message: {error}",
    "error_code": "order_item_103_9"
}
PreviousProduct CategorizationNextCommerce

Last updated 23 days ago

Was this helpful?