Introducing the Chargebee CLI

Bulk apply coupons to subscriptions

Problem Statement

You need to apply a coupon code to many subscriptions that match a saved filter.

Solution

Scope

Is there a way to bulk update a coupon code onto all subscriptions within a saved filter?

Summary

You will be able to perform a bulk operation to apply coupons on the current subscriptions using the filter on your Chargebee site from the Subscriptions Index Page and from Import & Export data.

Once the existing data is exported, you need to apply the codes to the CSV file and upload it. To perform the export and import operation, navigate to Settings > Import & Export Data > Choose a Bulk Operation in your Chargebee site.

If you are to perform a bulk operation for existing data from Chargebee you may have to export the data from Chargebee and update that data in the import sheet from Bulk Operations. Earlier the export data format and import data format varied, which involved a lot of manual intervention. With the new enhanced Export file option, you can either export a file using Download Data or use Download import-friendly file from Settings > Import & Export Data > Product Catalog. See How can I export items with the import format on PC 2.0? for more information.

Steps to Set Up

Step 1:

Legacy Product Catalog: You can perform this action from Settings > Configure Chargebee > Import & Export Data > Choose a Bulk Operation > Subscriptions > Update Subscription

Latest Product Catalog: You can perform this action from Settings > Configure Chargebee > Import & Export Data >

Choose a Bulk Operation > Subscriptions > Update Subscription for items

Step 2: Download the sample CSV file

Upon downloading the CSV 'update_subscriptions_sample_data.csv' file, update the current data from your site in the sample CSV

Step 3: You can export it from Chargebee, there are 2 different ways to achieve this:

a. You can also save the filter for future purposes, for more info on Advanced Filter Options. Set the Advanced filter and export the current subscription records.

On the recent UI enhancement you can now scroll the index pages - Customers, Subscriptions, Invoices, and Credit Notes vertically. Earlier, the pages will be paginated which may prolong your search; however, with the new enhancement, as you scroll down the list it will load all other data in a single page as highlighted below on the screenshot. See What is the enhancement on all index pages on Leap UI? for more information.

b. Navigate to Settings > Configure Chargebee > Import & Export Data > Export Data > Subscriptions > Select Criteria to Export > Export

Step 4: This file will contain sample records that you can replace with the current data records.

Note that the data that needs to be added to the sheet should be in the same format as the sample data.

Update the current subscription with coupon details.

Step 5: Save the CSV file and upload it.

See Bulk operations if you have received any errors while uploading the file.