https://github.com/bravetheskies/bulk-gift-card-import
Bulk gift card import tool for Shopify.
https://github.com/bravetheskies/bulk-gift-card-import
gift-cards migration ruby shopify
Last synced: about 2 months ago
JSON representation
Bulk gift card import tool for Shopify.
- Host: GitHub
- URL: https://github.com/bravetheskies/bulk-gift-card-import
- Owner: bravetheskies
- License: gpl-3.0
- Created: 2022-07-15T08:28:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-01T02:30:13.000Z (about 2 years ago)
- Last Synced: 2025-08-10T21:21:42.905Z (4 months ago)
- Topics: gift-cards, migration, ruby, shopify
- Language: Ruby
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bulk gift card import tool
Bulk gift card import tool is command line Ruby tool for [Shopify](https://www.shopify.com/).
:rotating_light: **This tool can only be used with [Shopify Plus](https://www.shopify.com/plus). You must create a custom app and [request the gift card API endpoint to be enabled](https://community.shopify.com/c/shopify-apis-and-sdks/gift-card-api-404-not-found-error/m-p/1397206/highlight/true#M74800) via [Shopify Plus Support](https://help.shopify.com/en/support).**
## Setup
The bulk gift card import tool is a simple Ruby command line tool. To install the package run:
```shell
bundle install
```
Create a custom app in the admin of the Shopify store you want to connect to, give the app `read_gift_cards` and `write_gift_cards` permissions. Once installed you must create a `.env` file in the following format:
```shell
SHOPIFY_DOMAIN=example.myshopify.com
TOKEN=< token for custom app >
```
## Usage
To bulk import gift cards create a CSV in the following format:
| Header | Description | Example |
| --- | --- | --- |
| Code | Gift card code. | `ABCD 1234 ABCD 1234` |
| Balance | Value of card in decimal currency. | `100.00` |
| Expires | Expiry date in `YYYY-MM-DD` format. Leave blank for no expiry. | `2025-01-01` |
| Note | Note field (not visible to customer). | `This is a note.` |
See also the [example.csv file](/example.csv).
To import your CSV use the following command:
```shell
ruby import.rb -f example.csv
```
## Troubleshooting
A "Not found" error generally means that the gift card API endpoint has not been enabled on the store you are trying to connect to.
## Exporting a CSV from a Magento database
```sql
SELECT `code` AS "Code",
`balance` AS "Balance",
`date_expires` AS "Expires",
"Imported from Magento" AS "Note"
FROM `magento_giftcardaccount`
WHERE `is_redeemable` = 1
AND `state` = 0;
```