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.
FoxyShop 4.7: Image Upload Update
Before upgrading, please read this carefully.
TL;DR if you allow customer uploads on your cart or have a datepicker calendar, you’ll need to add a new plugin before upgrading.
WordPress temporarily blocked access to FoxyShop from their plugin repo this week due to the fact that FoxyShop uses the flash plugin Uploadify to process our image uploads. When I first built FoxyShop, Uploadify was a great tool that was widely used, but since that time it has garnered a bad reputation as being insecure. I want to stress that our implementation of Uploadify is completely secure since we don’t use their image processing tool but use WordPress’ instead. We have the upload process fully locked down. That said, WordPress asked us to stop using Uploadify and disabled FoxyShop from the repo until we did so. I understand what they are doing and why, but it’s still a bit frustrating.
FoxyShop uses Uploadify in two places — the product upload within the product detail page and the customer upload tool (as a product variation). I have rebuilt the image upload tool using Dropzone which will allow you to upload images by dragging and dropping.
If your cart allows customers to upload images as part of their order, you will need to add a supplemental plugin called “foxyshop-uploadify” (download here). This adds the uploadify files back to WordPress and provides the theme files necessary to keep all the functionality that you’ve been using. If you have a foxyshop-custom-upload.php file in your plugin you’ll want to update the file references based on the ones that you’ll get in the foxyshop-uploadify plugin found above.
We also were alerted by the WordPress plugins team that the jQueryUI Datepicker widget is now bundled directly with WordPress. As a result, we have switched our include method to load the Datepicker directly from the WordPress files. There may be a few of you who were relying on the Datepicker files in the FoxyShop plugin. If that’s the case, you’ll want to download the files directly form jQuery UI and include them directly in your theme.
If you are confused about any of this, please write in. I’m happy to help answer any questions or help you get your site functionality upgraded. Thanks!
Other updates in 4.7:
- Update sub start and end dates to listen for FoxyCart date format (like 1m, 10d, etc.)
- Don’t load multiship JavaScript if multiship is not enabled
And other updates in the 4.6.x versions:
- WP 4.3 compatibility changes with widget constructor
- SSO endpoint now listens for update/cancellation and doesn’t query cart in those cases
- Update PrettyPhoto to 3.1.6
- Update Order Desk Link on Orders page
- Removing unneeded queries when setting up images
FoxyShop 4.6: Expiration and Reverse Login
FoxyShop 4.6 includes product expiration features and the ability to provide automatic login at your site after checkout.
Here’s the list of the new features and fixes in this release:
- Adding product expiration feature – use a number (minutes) or a date (Y-m-d in Pacific time) when setting up your products to handle time-sensitive products.
- Adding Reverse SSO functionality – log your customers into WordPress after checkout. See this link for setup instructions.
- Connecting featured images that weren’t uploaded to the product
- A custom image size called “featured” won’t take over the featured image functionality any more
- Fix to make sure that hidden required checkboxes aren’t required
- Adding filters to disable custom category sorting and provide your own custom sorting
Supporting Wholesale Users
There are a few different ways to support wholesale users with FoxyShop. The simplest is to have a separate batch of products that your wholesale users can order. In order to support this, I’ve put together an add-on plugin for FoxyShop which you can download here. Just download this file and put it in wp-content/plugins
. Then you can can go into WordPress and enable it.
This plugin requires the Advanced Custom Fields plugin (the free version is fine). Once this is installed, you’ll be able to edit your products and categories and set them with access restrictions. Then you can create your wholesale users and assign them to the Wholesale role.
You may also want to consider installing the Peter’s Login Redirect plugin to control where your wholesale visitors are sent after login.
I recommend putting this in your single product template:
//Check Access if (get_field("access_restriction") == "wholesale" && !check_user_role(array("wholesale", "administrator"))) { die("Please login before accessing this product."); } $product_categories = wp_get_post_terms($product['id'], 'foxyshop_categories', array("fields" => "all")); if ($product_categories && !is_user_logged_in()) { foreach ($product_categories as $term) { $access_restriction = get_field("access", $term->taxonomy . "_" . $term->term_id); if ($access_restriction == "wholesale") { die("Please login before accessing this product."); } } }
And this in your in your single category template (around line 25):
//Check Wholesale Access Restriction $access_restriction = get_field("access", $term->taxonomy . "_" . $term->term_id); if ($access_restriction == "wholesale" && !is_user_logged_in()) { die("Please login before accessing this section."); }
Adding these bits of code will further secure the wholesale categories and products from prying eyes.
Version 4.5: FoxyCart 2.0 Support
It’s been quite a while since I’ve released a new version of FoxyShop, but I’ve been storing up some incremental improvements. Version 4.5 has a number of upgrades and features.
FoxyCart 2.0: This new release supports the features and functionality found in FoxyCart 2.0 which is nearing public release. This means that you can select 2.0 from the FoxyCart Version dropdown and the proper includes will be bundled. If you are interested in upgrading to 2.0, please read this post.
Bundled Products: FoxyCart 2.0 supports bundled products and so if you are using 2.0, FoxyShop will now support bundles as well – letting you lock products to their parent products.
Version 4.4: FoxyCart Templates
Version 4.4 includes a host of small updates, new filters, and jQuery 1.10.1 support. There’s also a few new features to help you build dynamic FoxyCart stores even faster.
Important jQuery Note: The jQuery team made a big change in the 1.9 branch, removing support for .live(). This breaks a lot of older plugins. If you are using FoxyCart 1.0 or previous, FoxyShop will attempt to use jQuery 1.8.3. If you are using FoxyCart 1.1 or newer, the latest 1.10.1 branch will be used instead. To override, you can either include jQuery yourself or set this in your wp-config.php file:
define('FOXYSHOP_JQUERY_VERSION','1.8.3');
Please test your site after upgrade to make sure everything is working as expected.
Here are the highlights of this FoxyShop release:
Version 4.3.2: Custom Variation Names
Version 4.3.2 has an upgrade which will allow you a lot of flexibility with the variation field names. You can now customize the name of the fields and the value of each variation. This is very helpful if you’d like to use a variation to set the subscription frequency. Here’s an example of the new syntax:
Variation Name: Frequency{sub_frequency}
Just Once{v:} Every 2 Weeks{v:2w} Every Month{v:1m}
Version 4.3: Keeping Things Tidy
FoxyShop 4.3 is primarily a maintenance update but it does have some handy new features.
The new default FoxyCart store version is 1.0. (In fact, any new stores being created now won’t be able to build a 0.7.2 store.)
Native support has been added for the following fields at the product level: cart, empty, and coupon. So you can now check a box and instruct a product to add a coupon with the product or force a checkout. It should be noted that it’s generally a good idea to check the “Empty Cart” option if you are forcing a direct checkout. You can still use “cart”, “empty”, or “coupon” as a direct custom field if you want more flexibility. These new checkboxes are located under the subscription/discount information on the right side of the product page in the admin.
You can now add hidden product field variations. This gives you the flexibility to add a hidden field that will be included with the product when it goes to the cart.
Version 4.2: Variation Updates
FoxyShop hasn’t had an update for a few months but I haven’t been sitting around on my hands. In that time I’ve been hard at work on this maintenance version, preparing for the big FoxyCart changes coming with the rewritten API (exciting stuff), and working hard on Order Desk.
FoxyShop version 4.2 focuses on some improvements to the variations processor and a number of other updates and bugfixes. Here’s the rundown of what you’ll find in 4.2:
Variation Processor Updates
The variations will now allow multiple levels of d-keys to allow very complicated structures where each d-key’ed element is viewed on all previous elements instead of just a single level of dependency checking. Now you can have a shirt type which turns on embroidery type where a certain embroidery type turns on color options. The processor has also been updated to put an x: in front of hidden text and textarea input fields. This was already in place for select’s and radio buttons, but this now means that you won’t end up with text fields in your cart that weren’t viewable when the form was submitted. This also means that you can now have multiple hidden text fields that share the same name.
Updates for Multiple Products on One Page
Sometimes when showing multiple product forms on the same page there were some collisions with the galleries. PrettyPhoto galleries have been updated to include the product ID in the rel attribute so that multiple galleries won’t overlap on each other. Out of stock messages are now members of a JavaScript array so that having more than one on a single page means they won’t overwrite each other.
Google Product Feed
The Google Product Feed feature has been updated to add CDATA markup to content field and to allow for customizable target country and currency via filters. Note that this program has changed and you now have to purchase product ads. See Google’s announcement for more information. You can still submit your product feed but then you’ll go create ads in AdWords.
New Features
- Added settings option for disabling cart validation (if cart validation was currently disabled via the wp-config constant, new setting will be set to “off”)
- Added a filter for the post type registration argument array
- Added filter for disabling auto-login when new user account created
Improvements
- Allow saved variations to have custom names
- Updated hidden ikey images to be written out but hidden so cloudzoom will work properly
- Improved inventory update matching to only update published products, not those in trash. Also improved to handle the different ways that different servers write serialized datatypes.
Bugfixes
- Fix for double UTF-8 encoding on foxyshop_currency() – won’t do UTF-8 encoding if the localization name ends with .utf8.
- Fix for error/typo in customer email variable in subscription datafeed
- Fix to accept custom field search criteria in CSV export feature
- Fix for CSV export not showing proper amount for quantities greater than one
- Fix for the FOXYSHOP_PRODUCT_TAGS feature
Version 4.1.5: Catching Up on Updates
Versino 4.1.5 has been released with some patches and few small feature upgrades. It’s been a little while since a big release, but there have been several maintenance releases and some new features here and there. Here’s the skinny:
Version 4.1.1
- Added new setting so show a computed Add to Cart link with each product.
- Line breaks now shown on order page
- Multiship stores were seeing redundant shipping address in admin
- Setup page cleanups and a few syntax fixes in helperfunctions.php