Function #34: Automatically add a free item to the invoice based on the purchase amount

Function #34: Automatically add a free item to the invoice based on the purchase amount



Hello, everyone! Welcome back to our series.

It's the holiday season, marking a time when businesses witness increased demand for products and services, leading to a significant boost in sales. This also presents an opportunity for businesses to engage with their customers. As a gesture of appreciation and gratitude, many businesses opt to include complimentary items with customer purchases to enhance the overall shopping experience. Today, we bring you a custom function that automatically adds a complimentary/free item to the invoice based on the total purchase amount. 

Prerequisites: 

1. Create a Connection named "zbooks" to successfully execute the function. You can watch the GIF attached below to know how to create the connection. 



2. The items that will be given as free should exist under the Items module in Zoho Books.

3. To determine both when and what item should be given as complimentary, define distinct rate slabs in the script and assign a corresponding free item to each slab. In today's script, we have pre-defined 3 rate slabs.
If the invoice total is between $100 - $499, it is eligible for the free item A.
If the invoice total is between $500 - $999, it is eligible for the free item B.
If the invoice total is more than $1000, it is eligible for the free item C.

4. Create a Check Box-type custom field by the name "Include Free item?" for Invoices. Only when this field is ticked, the function will be executed to check the applicable rate slab.



Custom Function:

Navigate to Settings -> Automation -> Workflow Actions -> Custom Functions -> +New Custom Function > Add the function code from this GitHub link. 

Note: The custom function will be executed after the invoice is saved. 

Workflow Rule: 
 
Go to Settings -> Automation -> Workflow Rules -> +New Workflow Rule and set up the workflow rule as shown below:-






Here's how it works:

After creating ("Include Free item?" should be True) and saving an invoice, the custom function kicks in, checking the rate slab associated with the invoice. Based on the identified rate slab, the function automatically adds the corresponding free item. 

Try out this function and drop your feedback in the comments section. If you have any specific customizations in mind, don't hesitate to reach out to our support desk at support[at]zohobooks[dot]com. We're here to assist you.

Stay tuned for our next custom function. Until then, have a joyful holiday season!

Regards,
Shireen Farhana
Zoho Books

    • Recent Topics

    • Tip 52#: Ways to improve data flexibility using related list

      A related list offers an ideal solution to string related data across entities together. It enables you to pull records from any module or external source and float them as a tab within your project, sprint, epic, work item, or release detail view layout.
    • Email Blast

      Hi, How do we send an email blast to thousands of customers? The email addresses are not yet saved in Zoho Desk.
    • Zoho ERP | Product updates | September 2026

      Hello users, A new month, a fresh set of updates in Zoho ERP. This month brings Netting, enhancements across our verticals, and more updates to help streamline your everyday work. Explore this month’s updates and see what’s new. Introducing Netting If
    • Introducing Zoho POS for Restaurants

      Hello Community, We’re thrilled to announce the launch of Zoho POS for Restaurants, unveiled at the 30th milestone edition of Zoholics India 2026. Running a restaurant involves multiple teams and workflows. A single table journey, from seating a guest
    • WhatsApp Business Message Pricing Update: Effective October 1, 2026

      Hi everyone, Starting October 1, 2026, Meta is updating how WhatsApp Business messages are charged. This guide explains the new per-message pricing model, how message categories work, and what changes for service messages specifically. How Meta charges
    • Zoho Calendar integration for Bigin

      Hello everyone, We're excited to introduce Zoho Calendar's integration in Bigin! For a while now, users have been able to sync events in Bigin with Google Calendar and Outlook Calendar - but with this new topping, it syncs with Zoho Calendar as well.
    • Does Updating Employee Names and Profile Pictures in Zoho One Automatically Sync Across All Zoho Applications?

      Hi Zoho Team, We are currently using Zoho One in our organization and want to centrally manage employee profile information. As a Zoho One Super Admin, if I update the employee name and profile picture for all users from the Zoho One Admin Panel, will
    • Enhanced shared mailboxes: Dedicated Sent folders, Run-through filters & fresh UI

      Hi everyone, Collaborative communication is the backbone of smooth operations; whether you are handling customer support queries, managing vendor requests, or tracking sales leads. Shared mailboxes in Zoho Mail ensure your team stays on the same page
    • 10/22 15時〜 オンラインもくもく会のお知らせ | Zoho ワークアウト

      ユーザーの皆さま、こんにちは。コミュニティグループの中野です。 10月22日(木)開催の「Zoho ワークアウト」をご案内します。 Zoho ワークアウトは、参加者それぞれが取り組みたいテーマを持ち寄り、ユーザー同士で交流しながら、 設定・検証・運用改善を進めるオンラインの「もくもく会」です。 「試してみたい設定があるけれど、なかなか時間を取れない」 「一人で進めていると、途中で手が止まってしまう」 「他のユーザーの活用方法や工夫を聞いてみたい」 そんな方は、Zoho ワークアウトで一緒に取り組んでみませんか?
    • Reporting tags associated to Project in Zoho books?

      Hi, I know you can add reporting tags to contact, articles and transactions. Is it possible to add reporting tags to Project. We Zoho reports I would be able to generate reports by tags. Sometimes tags for a contact is different for projects (ie Projects
    • Reporting Tags in Profit and Loss Reports Analysis

      Hello Community and Zoho Books Product Team, I would like to highlight a limitation I encountered with Reporting Tags in Zoho Books. Reporting Tags Not Applying to Automated Inventory Journal Postings from Product Invoices. For inventory product invoices,
    • Spam Quarantine: Manage suspicious emails in Zoho Mail

      When an email is quarantined by spam processing, it need not always be blocked right away. Some emails may be marked incorrectly, or may need to be reviewed before a final decision is made. The Spam Quarantine feature in the Zoho Mail Admin Console gives
    • What is the difference between "Reply" and "Public Comment" in a ticket?

      Hey, my company is thinking about switching to Zoho Desk but we do not understand the difference between the "Reply" and the "Public Comment" feature. When should we use which? And why? What is the difference between them? Thank you for your help! Kindest
    • Comments Vs. Replies

      I'm curious as to the difference between a "Reply" and a "Comment" on a ticket. It appears that "Replies" are what's used to determine response time SLA's and there are also used to automatically re-open tickets. I'm just trying to understand the key differences so I can educate both our clientele and our back-end users on which function/feature to use to better improve the ticket lifecycle. If anyone has any insight it would be appreciated. Thanks!
    • What's New in Zoho Inventory | July & August 2026

      Hello users, The July and August 2026 releases bring a range of new features and improvements across the product. From the Nigeria Edition and Super Admin enhancements to Sri Lanka IRD-compliant invoicing, Loyalty Program Management, and improvements
    • Forms data export bug

      The export csv with a password has changed for the worst. It is less secure by not allowing complex passwords. Just last week and the last year (at least) I was able to use a complex, secure password. Export CSV moreover doesn't even work if I use a simple
    • Fax and email questions

      Does Zoho offer faxing capability? If so, how to do it? And, why is has my email inbox stopped in 2019? There are no more emails since then. Also if I delete all of those emails, will they delete it from my gmail account (I'm linked to a gmail email address).
    • Create a single record from multiple images with ICR

      Hello all, Zia's Intelligent Character Recognition can now create a single record from multiple images based on the configured ICR rule. Users can upload up to three images at once, such as an ID, a passport, and a business card, and Zia will extract
    • How to present an Analytic on a CRM dashboard and filter it on loginuser id

      How to present an Analytic on a CRM dashboard and filter it on loginuser id? I want to display an Analytics pivot table (as a widget) on a CRM dashboard and have the pivot filtered on the loginuser. I want additional user-filters available, such as date,
    • CNIL - Suivi de Pixel

      Bonjour à tous, À la suite de la nouvelle recommandation de la CNIL sur les pixels de suivi dans les e-mails, savez-vous si Zoho Campaigns permet : de conditionner le suivi des ouvertures au consentement de chaque contact ; de proposer un lien permettant
    • Setting default From address when replying to request

      At the moment, if I want to reply to a request, the From field has three options, company@zohosupport.com, support@company.zohosupport.com, and support@company.com. The first two are really internal address that should never be seen by the customer and
    • Zoho Payroll: Product Updates - Q3, FY2026

      Over the past quarter, Zoho Payroll has added several updates to make payroll easier to process, configure, and manage. The most notable improvements cover bank integrations, reimbursement support, payslip enhancements, employee exit documentation, payroll
    • Convert OLM to PST on Mac and Windows Using Free Methods

      When your Outlook for Mac data is stored in an OLM file and you want to use it with Outlook for Windows, the simplest approach to transfer your emails and other mailbox information is to convert the OLM file to a PST file. OLM is primarily associated
    • Add Payment Information (like Bank details)

      I am using the Free plan of Zoho Books. I need to add the bank details/ UPI details on the invoice. How can I do that. I have added the details in the Bank Section.
    • Placeholders for Multi-Level Discount

      I am using custom templates for Invoices and all other modules. Since i have activated multi-level discount (an early-access feature from zoho) "discount at line-item and transaction level", I need placeholders for using them in my custom templates. With
    • Running Balance

      Please add automatically Running balance in ledger view. Taking lot of time, every time to add manually
    • Accounting on the Go Series-47: Effortless GSTIN Management- Auto Populate TaxPayer Details in Zoho Books Mobile App

      Hello everyone, Welcome back! Today, we're focusing on a feature specifically designed for our Indian users in the Zoho Books-Indian edition, particularly those who deal with GST compliance regularly. We understand the importance of accurate and efficient
    • URGENT: Stalled DC Migration >72 Hours - Records Locked [Ticket #: 167813877

      The DC migration was started on 1st October at 6 pm and we were informed migration period as 48 hours but even after more than 72 hours, the migration seems still in progress. We sent two emails to check the status but no responses. We need the migration
    • Zoho Webinar - Sharing System Audio (NOT AVAILABLE)

      Hi, We are having a serious problem with Zoho Webinar. In the webinars we run, we very often share the audio from a video we are streaming directly from YouTube or other applications. Until recently we were using Zoom, but as we use other Zoho applications
    • Cash Recipt

      You can not receive cash more than 10000 from one party in a day and two lakh in a year. In statement you can't differentiate cash or bank receipt. zoho does not support this
    • Need to set workflow or journey wait time (time delay) in minutes, not hours

      Minimum wait time for both Campaigns workflows and Marketing Automation journeys is one hour. I need one or the other to be set to several minutes (fraction of the hour). I tried to solve this by entering a fraction but the wait time data type is an integer
    • Concern Regarding Stock Validation in Inventory Management

      Hi Zoho Team, We would like to highlight a concern regarding stock validation in the inventory system. As per standard inventory management practices, if the stock level is zero, the system should not allow users to create a shipment, packing slip, or
    • Change from OST to PST on Windows 10/11 Using Free Method

      There is an advantage in converting OST files to PST format if you need to access your Outlook data on a different computer, want to keep a local copy, or are trying to recover items from an old Outlook profile. The good point is that users of Windows
    • Important: Whitelist new proxy outgoing IPs for IN, SA, and UAE data centers

      Hello everyone, We're expanding the pool of proxy outgoing IP addresses for our IN, SA, and UAE data centers by introducing new IPs alongside the existing ones. This helps ensure high availability, optimal load distribution, and redundancy for outgoing
    • Zoho Flow Custom Function Issue

      I have a use case where I will be needing to post data to a wordpress site. Specifically to a custom post type with a bunch of ACF fields. I have setup trigger event correctly for Tookan and can receive data from the webhook. In order to post the data
    • How to Open .mbox file in Gmail with Attachments?

      Gmail offer users to backup INBOX folder in .mbox file format via Google Takeout Feature. Howver there is no such option to Restore Gmail MBOX. Thus I would like to suggest you to choose an alternate approach i.e. MBOX to Gmail Wizard. This utility will open .mbox file in Gmail with attachments.  Steps to open MBOX file in Gmail are; Run MBOX to Gmail Wizard Click Add File and add .mbox file. Enter your Gmail login credentials. Click Convert button. Finished! This is how you can open MBOX file in
    • Custom Validation for On Duty

      Hi Team, We would like to have custom validation support for the On Duty form in the Attendance module. We need to apply some restrictions, such as: Limit the number of On Duty requests per month. Restrict On Duty requests on selected days. Allow employees
    • Integrating FaceBook Ads into MarketingHub

      I would like to track the clicks from a FB Ad campaign into my website via marketinghub.  I cannot currently add a MH form directly to my FB page, as I receive an error telling me I need at least 2000 subscribers on FB to be allows to do that (yikes!) What is the best way to set up MH so I can track which FB are converting well?  I know I can reach the FB reports directly, but these do not track conversions from the MH forms on my website. Best regards, Joe
    • Migration from GoDaddy to Zohomail

      Hi All, I am trying to migrate all the emails from Go Daddy to zohomail account using the migration tool. i tried with imap method, its not working. when i try it with pop method, then only the emails from the go daddy account inbox ( not other folders), is getting transferred, how can i transfer all the folders in the email account from go daddy to zoho. and also the emails which are coming from go daddy are like new unread emails ( is there any where i can differentiate from read and unread emails)
    • How do I migrate from Office 365 to Zoho Mail?

      Check out Advik Email Migration Wizard, this software is specially developed to move mailboxes from Office 365 to Zoho Webmail. In addition you can migrate from Gmail, Yahoo, Rediffmail and 80+ webmail servers to ZOHO MAIL. Isn't it amazing? This is an all in one email migration solution. Steps to export emails from Office 365 to Zoho Webmail are as follows; Run Advik Email Migration Tool in your system. Select Office 365 as source and enter its login credentials. Select mailbox folders and choose
    • Next Page