I'm trying to integrate ZOHO books invoice system with Woocommerce. I'm creating a sales order using API which is later converted into an Invoice and trying to add discounts for both levels. One in items_level that is attached with line items and another in entity_level should be applied on the subtotal of line items before the tax calculation.
The issue I'm facing is the API applying the discount only at entity_level(ignoring items_level), whereas I'm adding discounts for both in the API request body. (See the attachment)
Request body:
{
"customer_id": "123456789",
"date": "2022-03-05",
"shipment_date": "2022-03-05",
"is_inclusive_tax": false,
"place_of_supply": "DL",
"salesperson_name": "ABC",
"gst_treatment": "consumer",
"line_items": [
{
"rate": '999',
"name": "Product_Name",
"description": "Product_Descp",
"quantity": 1,
"product_type": "goods",
"discount": "10%",
"tax_id": "123456000",
"hsn_or_sac": "200200"
}
],
"billing_address_id": "12347890",
"shipping_address_id": "12347891",
"tax_id": "123456000",
"discount": "202.89"
"shipping_charge": "40",
"delivery_method": "delivery_method_name",
}
I want both to work together because I need to show coupons discounts at entity_level (if coupon applied during checkout) and sales discount at items_level. Is there any setting or any other way to add discounts on both levels simultaneously?
Any help will be much appreciated!
Thanks,
Zoho Books does not allow entity and item level discounts to be applied simultaneously. You have to choose one of them by setting the API key "discount_type" to be "entity_level" or "item_level".
The API has another key to calculate the discount before tax, which is "is_discount_before_tax".