Version 3.4: Add-on Products
Here’s a rundown of all the goodies in FoxyShop version 3.4:
Add-on Products
This is the biggest new feature: you can now add products that are a bit like bundled products but will show up on your product page with a checkbox. This will work nicely for up-selling and attachment products. Note that variations inside of add-on products are not supported. It’s also recommended that you don’t add more than 10 add-on products to any one product because of IE’s URL max-character limit.
If you want to use add-on products and already have a customized foxyshop-single-product.php template you’ll need to add this line to your template where you want the add-on products to display: foxyshop_addon_products();
New Tools Page in Admin
There’s a new tools page in the FoxyShop admin with lots of added functionality:
- Recommended plugins with direct download links
- Google Product Feed moved here
- Import/Export FoxyShop settings (includes category sorting, too)
- Tool to scan for old variations
- Tool to flush rewrite rules
- Reset API Key tool moved here
- FoxyShop uninstallation instructions
Social Sharing Fields
Meta tags for FaceBook’s open graph have been added to the html header of product pages. This means that when clicking a Like button from a product page, you’ll get the product title and the product image pre-loaded. G+ meta tags have been added as well. If you’d like to disable these meta tags, there are instructions on the Advanced Settings page.
Inventory Updates
The Manage Inventory page has gotten a facelift. It now looks more like a standard WordPress list. You can now update your inventory numbers directly from this page. It even uses a “SmartUpdate” feature that won’t overwrite any recent changes. For example, if you are updating inventory numbers and someone else makes an update or an order comes in while the page is up, it will make your changes based on what your initial value was rather than a complete reset of the field. There’s also a new feature to export and import all you inventory values at once so that you can edit them in a spreadsheet program. (This method doesn’t utilize the SmartUpdate.)
Order Management Facelift
The order management view, customer view, and subscription view have also gotten similar facelifts with standard WordPress lists. Additionally, all order data is now saved locally on the page and served immediately. This speeds up the process dramatically since you won’t have to query the (kind of slow) API for each order.
Misc Improvements and Fixes:
- Product weight can now be disabled on a per-product basis if you don’t want to pass weight to the cart
- SSO Update: redirection url now persistent throughout login/redirect process
- Browser title filter will be skipped if a title isn’t set – helpful for compatibility with SEO plugins
- Orders and subscriptions will display results immediately without having to make an initial search (can be disabled by setting constant in wp-config.php)
- Added depth option to category list widget
- Bugfix: category list widget wasn’t saving top-level term
- Added a number of filter hooks
Tutorial: Pricing Based on Inventory
FoxyShop was developed to be extremely flexible so that developers could do anything they needed to with the product structure. Recently I had someone come to me looking to charge different amounts based on the inventory level. It was an interesting challenge and I want to share it with you the results as a guide for your own “extreme” customizations.
Take a look at the source code.
This particular product needed to charge $5 if there were 100 tickets available, $10 if there were under 90, $20 if there under 60, and $25 for the last 20 tickets. I put the source code from the link above in my functions.php file and then setup the new Price Levels field with the syntax as you see in the image at right. This new field is added by the custom code – you can add any fields you want with this hook.
The specialized code uses hooks to tie into the core FoxyShop functionality. In this case, we’re checking for the new custom field and if it is set, we’re looking at the current inventory and adjusting the price. This happens deep within the FoxyShop process so it will be applied anywhere FoxyShop grabs the price. It also ignores this functionality if the customized price field isn’t set. Of course, you’ll have to set the inventory for this particular product code.
While you may not need this exact feature, this guide can serve as a helpful starting point for your own customization with examples of how to tie into FoxyShop’s core. As always, if you need a hook or filter added to the core for some functionality I haven’t yet thought of, please let me know. I’m here to help!
Version 3.3: Tags, Quantity, and Increased Flexibility
Here’s a rundown of all the new FoxyShop goodness you’ll find in version 3.3 which is now available:
Related Products By Tag
If you want to setup related products by tag instead of assigning related products manually, there’s now a function to do just that. You can use both the tag version and the manual version, but if manual related products are there, they will be used instead of tagged products. Additionally, these are not Post Tags but a new custom taxonomy called Product Tags. If enabled, you can assign Product Tags in the right sidebar of the product admin page. Note that product tags are only available if you are running WordPress 3.1+.
Another new feature introduced with Related Products is the ability set the order of Related Products (manual, not tags). There’s a new field underneath the Related Products box which lets you set the order by ID number. Separate the ID’s by comma.
Added Setup Wizard
There’s a new setup wizard to help new users get up and going fast. There’s also an alert bar to help you start the setup process that will show up at the top of your admin if you haven’t set up your FoxyCart domain yet. This bar can be hidden if you don’t want to be nagged.
Added FoxyCart 0.7.2 Support
There will be more features coming in related versions, but you’ll now be able to set your FoxyCart version 0.7.2. Note that as of this release, 0.7.2 is still in private beta but should be entering public beta in a few weeks. Do not switch to 0.7.2 in the admin without also changing your version on the FoxyCart side as well. If using 0.7.2, FoxyShop connects to FoxyCart during the Settings save process and grabs the latest embed codes to ensure you are always staying up to date. This is helpful if you aren’t keeping your FoxyShop version up to date.
Quantity Box Can Now Be Hidden
If you don’t want some products to have a quantity box on the product page, you can now disable it in the product’s setup. There’s also new icons for the quantity minimum and maximum.
No Image Option
If you don’t want to include images for some or all of your products, you can now go to the Manage Settings page and turn off the default “No Photo Available” image. When “Don’t Show a Default Image” is selected, no image will be sent to the cart if an image is not available.
New Hooks
foxyshop_setup_product_info — add your own values to the $product array
foxyshop_admin_product_details — add your own options to the product details metabox in the admin
Set cURL Timeout Lengths
If your cURL connection to the FoxyCart API is timing out, you can set the timeout lengths to be longer with new customization settings. See Advanced Settings for more information.
Shortcode Links With Variations
You can now pass in variations when creating links with the product shortcode. See the instructions for more details. You can also now use the product shortcode without including content and it will assume “Add to Cart” as the button title.
Added Flexibility to the Variation Function
Designer’s rejoice! If the clearing div’s from the variation function were getting in your way, you can now get rid of them by passing in an empty string to the new $afterVariation argument. There’s also a new $beforeVariation argument as well. See the docs for more details.
Added JavaScript Hooks
Two JavaScript hooks have been added to the variation functions. If you need to fun your own functions before and after the ikey image is changed, you can do so by running the functions foxyshop_before_image_change and foxyshop_after_image_change. A bug keeping an ikey in the first selectedIndex from showing up has also been corrected.
Smart Variation Pricing
If your variation name is a price and is the same as the adjusted price $50{p:50}
, the price in parentheses will not be shown. Duh.
WordPress Registration Login
WordPress registrations are now automatically logged in after signup. You will need to set a redirect_to field in your registration form or the default landing will be the login page so it won’t seem like the user is logged in at first.
Other Fixes
- Changed unserialize to maybe_unserialize to prevent any caching conflicts during upgrade. This seemed to be an isolated incident with a W3 Cache install.
- Cleaned up a PHP notice on first activation and streamlined the automated upgrade activation process
- More optimizations and standardizations to the template redirection function
- Bugfix: Removed a bit of testing code from the datafeed endpoint that was showing up where it shouldn’t have been and was keeping the foxy response from returning correctly.
- Added files for jqZoom to make custom integration easier.
- jQuery updated to version 1.6.4.
- jQueryUI Datepicker updated to version1.8.16.
- prettyPhoto updated to version 3.1.3.
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 3.2: You’ll Be Hooked
It’s not the first corny WordPress dev joke and it certainly won’t be the last. FoxyShop version 3.2 has introduced a number of filters and actions that will make it easier to integrate your own functions into FoxyShop. Here’s a rundown on the new additions:
SSO Improvements
Single Sign On support has been reworked to be more flexible. It’s also a lot more reliable in that it pulls the email and password from the database and sets them directly to the FoxyCart user. Previously it relied on grabbing form fields that may or may not have been there. The biggest improvement, though, is that there’s now a filter called foxyshop_save_sso_to_foxycart which lets you hook your own function in to add your own metadata to update the FoxyCart user. This could be address, phone number, etc.
More Hooks
More action hooks were added to the admin for your integration enjoyment.
- foxyshop_save_product: Hook into the product saving process.
- foxyshop_order_search_buttons: Add more buttons to the order management page to integrate your own reports
- foxyshop_order_line_item: Add more links to the end of each order line to integrate your own actions
- foxyshop_show_user_profile_data: Add more custom fields to the user profile (only for admin viewing)
Easier Printable Receipts
On the order management screen you can now access the FoxyCart receipt and the printable receipt on an order-by-order basis. Just click the FoxyCart icon for the FoxyCart receipt and the order number for the printable receipt.
Bugfixes
- Cart session fields like cart, coupon, etc should not have hmac verification attached. This has been corrected.
- Fixed the broken “no image” images in the admin view.
- Fixed javascript error when jQuery acting in noConflict mode (fixed in 3.1.1)
- Image uploader wouldn’t work if product title had an & – fixed! (3.1.1)
- Started the enqueue earlier for the foxyshop.css file so it is easier to unregister if desired (3.1.1)
- Rewrote foxyshop_simple_category_children function to add depth option (show all levels of categories) (3.1.1)