Sell Gift Cards with FoxyShop
Our gift card feature lets you sell gift cards on your FoxyShop site, and when ordered, automatically creates the card code and emails it to the gift recipient. Here’s how to set it up.
How Gift Cards Work
Gift cards are similar to coupons in a few ways. Just as a “coupon” in Foxy defines the coupon itself, and the “coupon code” is the important bit that’s entered by the customer, gift cards similarly have “gift card codes” that are the individual resource the customer enters onto the checkout. Unlike coupon codes, however, gift card codes can have balances, allowing them to be reused until the balance is reduced to zero. Also, unlike coupon codes, gift cards will apply to shipping costs.
Though Foxy provides a number of ways to restrict and limit gift cards, most merchants will not use any restrictions. Further, though Foxy allows setting expiration dates, “normal” gift cards in most countries/states/provinces/regions cannot legally be expired. If you plan on using some of the functionality allowing you to restrict gift cards, be sure to check the laws for the locations you sell into.
Selling & Automatically Provisioning Gift Cards with FoxyShop
Gift Cards are created in our newer admin at https://admin.foxy.io. This admin has all the menu options needed to set it up. You can use your legacy admin credentials on the newer admin.
Note for API users: You can also do the setup with the API, but instructions for that will not be covered here. Please see our gift cards article in the regular Foxy wiki for API request details and our API documentation.
Provisioning the gift card
When setting up the product, you can use an existing category for your gift card or create a new category. You’ll need to pass this category with the add-to-cart, and when this product is purchased, Foxy will use the email template that you set up to notify the gift recipient at the specified gift recipient email address with a newly-generated gift card code.
To create a new gift card category, you can do this in the newer admin at https://admin.foxy.io. Check to make sure that your settings for the Delivery Options and Emails are set up as in the screenshot below. You can opt to not send an email to the recipient, but you should make sure that you know for sure that you don’t want to send it.

Next, you’ll create the gift card in the admin at admin.foxy.io. Once that’s completed, you can enable it as a “product” that can be purchased by your customers, and delivered (via email) to a gift recipient. To enable using the admin, you’ll set up the provisioning section:

The Allow customers to buy this gift card option can be set to unchecked to disallow new gift cards from being purchased by customers. The Min and Max balance values allow you to set minimum and maximum values for gift cards that are added to the cart, to prevent values outside of a desired range.
Creating the gift card product
You will create a gift card add-to-cart within FoxyShop using the following as a guideline:


name, price, gift_recipient_email, category for the gift card, and code should all be required. The code should match gift_card_ plus the sku from the gift card. So, if you gave the gift card a sku of widgets as in the example above, the code would be gift_card_widgets.
- The matching code in the example screenshot will result in the product showing in the cart with a product name of “Gift Card”.
- The gift_recipient_email submitted by the customer must be a valid email address. If you’re using the DEFAULT category for your gift card email, you don’t need to pass a category.
- Optionally, you can use a variant of gift_recipient_message to show on the default gift card email to the gift recipient.
For tips on customizing the gift card email, you can see our article below. Note that this is advanced:
Customizing the Gift Card Email
Notes & Considerations
Gift Card UI
Gift cards can only be viewed, created, modified, etc., via the new Foxy admin at admin.foxy.io, or via the API. Support will not be added to the old admin.
How Gift Cards are Attached to Customers
When a customer uses a gift card code (or on creation, if desired) and does not check out as a guest, that gift card code will be attached to the customer record. After that point, only that customer will be able to use the gift card code at checkout. If a different customer attempts to use that gift card code, the customer will see an error.
Note also that gift card codes can be attached to customers via the API.
Gift card codes that are attached to a customer will automatically be applied when that customer logs in on the checkout.
Coming soon: Customers will be able to attach a gift card to their customer account from the customer portal.
Accounting Considerations for Cash v. Accrual Based Bookkeeping
Before you start selling gift cards, you’ll likely want to chat with your accountant to ensure you’re not setting yourself up for headaches. If you sell a $100 gift card, you get $100 now, but you’ll generally also have a $100 liability to account for. Just make sure you know what you’re getting into so you can avoid problems.
Multiple Currencies
A gift card in one currency cannot be used if the cart is in a different currency.
Gift Cards & Subscriptions
If a gift card is applied to a subscription, the gift card will continue to apply to the subscription until its balance has been completed used up. The gift card will remain attached to the subscription, but will just not apply any discount. This means that if further balance is added to the gift card, it would start applying additional discounts to the subscription at the next renewal.
Note that even if the gift card reduces the cost of the subscription to $0, the customer will still need to provide a payment method on the checkout. Then, once the gift card balance is exhausted, the customers saved payment method will begin being charged for the subscription renewal.
Taxes, Shipping, and Product Restrictions
If you set a product or category restriction on the gift card, but the transaction contains items that are not covered by the discount, taxes and shipping will still be discounted using the gift card balance.
For instance, let’s say you have a $30 Shirt and $30 Pants in the cart, $6 taxes, and $10 shipping. The customer applies a $100 gift card that only applies to Shirts. The discount applied would be $46.
If you have a use case where this causes a problem and where coupons wouldn’t make more sense, please do reach out to let us know about it.
Step-by-Step Guide for Nonprofits
This is the moment you’ve been waiting for. Setting up your own donation page!
Within the FoxyShop plugin, click on Add New Product. Set the base price to 0 and remove the quantity and weight fields.
You’ll also want to add an image for your product.

The goal here is to get a super flexible donation page which will allow your constituents to pick a specific donation amount, specify a custom amount, and decide if they want to give a one-time gift or a recurring gift.

For this product, check the two checkboxes to “Force Immediate Checkout” and “Empty Cart Before Adding Product” as shown below since we won’t really need the modal cart functionality.
To get the donation page functionality we need, we’ll need to set up some specific product variations.

Create a product variation called “Donation” of variation type “Radio Buttons” with the following data:
$5{p:5}
$10{p:10}
$25{p:25}
$100{p:100}
Other{dkey:custom-price}
Next, create a “Single Line of Text” variant named “Donation Amount{price}” and set the “Display Key” to “custom-price”
Finally, create a “Drop Down List” variant named “Frequency{sub_frequency}” with these values:
Just Once{v:}
Every 2 Weeks{v:2w}
Every Month{v:1m}
Save the page. To add a link to this page in your menu, create a new page in WordPress of format “link” and point it to the url of your products.
If you’re using the Other donation amount, this setup will add the correct amount to the cart, but won’t dynamically update the price on the page. To do that, you’ll need to apply a script to the page, just before the closing </body> tag. You can grab the code here. If you need assistance on how to do this, contact us here.
Disclaimer
How To Build Custom Price Fields
Note: This page was updated on November 21, 2017. The previous approach outlined here is no longer necessary for creating a custom price field. Comments may refer to the previous article, but we are leaving here for future reference. If you have any questions, please contact us here.
Please see this article for instructions on how to create a field that allows a dropdown plus “Other” for custom donation entry.
Version 1.60: Inventory Management
In version 1.60 you’ll find a new feature that lets you manage your inventory levels for all products. To set this up, check the “Management Inventory Levels” box on the settings page. You’ll get an endpoint URL which you need to load into your FoxyCart admin. In the FoxyCart advanced menu, check the Datafeed box and paste in your endpoint url. This is a randomized url for security. Now, when you are editing products you will be able to add product codes and set inventory levels for these codes. On the settings page you can set the master alert level (the number at which the user will be warned that there are only a few items left).
After an order is complete, FoxyCart sends the order details back to the store and the appropriate quantities are deducted from the product codes that were ordered. Here are a few notes for a successful implementation:
- If you are adding this feature to a customized theme, make sure you add the function foxyshop_inventory_management() to your single product template files. See the new template files for an example.
- By default, once a product reaches a quantity of 0, the customer won’t be able to order it any more. If you want to let them continue to order (backorder) products, you can do so by customizing your theme files and passing a “true” variable to the inventory management function. See the theme files for an example.
- You can also pass customized verbiage to the inventory management function as well. Or you can remove the language completely if you don’t want to alert the customer to a low inventory level.
- The inventory manager isn’t fool-proof. If the alert level is set at 3 and you have 8 products in stock, the customer could order 10 and the order would go through. If you are worried about this, you might want to set a higher alert level and remove the customer notice. This is in place because it seems to be a security risk to show all your inventory levels in the javascript source on the page.
Note added 4/18/2018: This is no longer an issue due to updates. See these links for inventory functionality updates:
https://foxy-shop.com/version-2-3-variation-inventory-update/
https://foxy-shop.com/version-3-8-inventory-and-api-updates/ - In case you were wondering, order codes are tied to variations as well so if you select a different variation which changes the product code, the message will change on-the-fly.
- Single products and one-level variations are supported. Each inventory item must have a unique product code. Remember that product codes can’t be added to a unique intersection of variations (for example: color Green, size Medium). So you have to keep your variations somewhat simplified.
Also in version 1.60:
- Product url added to the information sent to the cart (FoxyCart version 0.7.1 only)
- Price validation bug for bundled products corrected
- FoxyCart 0.7.0 include files updated to latest versions
Version 1.4: Improved Image Support
Version 1.4 of FoxyShop is out in the wild. Here’s a run-down of the new features and fixes:
New Feature: Improved Product Image Support with Dedicated Bar
The biggest new feature is that there’s now a dedicated image bar on the product page. Let’s face it, the default WordPress image management utility is clunky and takes a long time to load. This new image bar will let you load your images a lot faster. You can also set featured images, rename images, and even rearrange the order just by dragging.

The yellow box indicates the featured image. Click a star on another image to switch featured images. Click X to delete the image. Click the middle icon to rename the image. After clicking the rename button, enter the new name and press enter. If you change your mind, press escape. To rearrange the images, just click and drag the image to its new location. There’s no need to Update your product after making changes: all changes are saved instantly through the magic of AJAX.
New Feature: Product Sitemap Creation
If you check this new option on the settings page, FoxyShop will automatically create a product sitemap which you can submit to Google or any other search engine. If you are using categories, category pages will also be added to your sitemap. WordPress 3.1 is recommended so you get those awesome hierarchical url’s. The sitemap is recreated when you save a product or click Save Settings on the settings page.
Calendar popups added for sale and subscription date selectors
When you click these date fields you can either select from the popup calendar or just enter your own date. Note that this is only enabled for WordPress version 3.1 and up because WP 3.0 was using an older version of the jQuery UI core which is incompatible with the newer datepicker scripts. Upgrade people!
Theme file jQuery updates for sub-category wrapping
Sub-categories weren’t always wrapping properly. This was fixed in the foxyshop-single-category.php file on line 65.
Template redirect adjustments for some (wonky) WP installs
As crazy as it sounds, WordPress query vars aren’t that consistent across different installs. There was another variation of query vars for the product and category homepages that are now working properly in the theme redirection file.
Added settings link to WP plugin page
Making it easy to get to the settings page after activation.
Added base name customization option to breadcrumbs function (Products)
If you want to make your breadcrumbs say “Our Amazing Products >> Product 1”, you can now do that. Knock yourself out!
Added February 15, 2018:
To change the “Products” language in the title of the all products page and also in the breadcrumbs, you can copy some of the FoxyShop plugin theme files into your own theme folder to edit. You’ll find these files within the themefiles folder of the FoxyShop plugin.
Specifically, you’ll want to copy the foxyshop-all-products.php file and edit this line to change the title:
echo 'Products
'."\n";
For the breadcrumbs, you’ll copy the foxyshop-single-product.php file to the theme folder and edit this line, changing the “Products” text accordingly:
foxyshop_breadcrumbs(" & raquo; ", "& laquo; Back to Products");
Improved Post Thumbnail Setting Reliability
Sometimes the post thumbnails theme support was being set by the functions.php or another plugin and was keeping them from working. The switch has been moved to the ‘after_setup_theme’ hook and gets turned on more reliably now. Note that post thumbnails are being turned on for ALL post types.
Enjoy, and post here if you run into any troubles with the new features.

