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.

Upgrading to FoxyCart 2.0

It seems like FoxyCart has been working on version 2.0 forever — well it almost has been forever. But their hard work has paid off and it’s almost ready for release. It’s been in public beta for a couple of months and it is now solid enough to install on most sites. In this post, I’ll describe some key features and some of the things that you’ll want to look out for when upgrading.

Before You Start

2.0 is still in beta. It’s getting very solid, but you may encounter some rough edges so be aware of that. If you do run into issues, you will want to email FoxyCart support.

Once you upgrade, you can’t go back to 1.1. So either create a test store, or be sure you really want to do this. When upgrading, keep in mind that your old templates will be blown away so if you had custom scripts, those should be safely downloaded first. If you have custom wording in your email template, be sure to save it first.

I recommend using FoxyCart’s default responsive checkout. It looks very nice and modern and is fully mobile-friendly. If you still want to skin the checkout to match your header and footer and fonts/colors, you’ll definitely want a test store so you can spend some time playing with it.

Prepare a file with your site’s logo. It should be wider than it is tall and 280px wide. Bonus points if it’s a transparent PNG. Upload this to your site and keep the url handy.

Upgrade FoxyShop to at least version 4.5.

Does your store use Colorbox for gallery image popups? If so, you will want to be ready to either switch to PrettyPhoto or load the ColorBox files on the site yourself. The new version of FoxyCart does not use ColorBox but instead a brand new modal overlay that has been custom-developed by FoxyCart called Sidecart.

The FoxyCart 2.0 documentation is available here: https://wiki.foxycart.com/v/2.0/start. Pay special attention to the changes in the templating and cart js sections. If you had old code that worked with the fcc object or with ColorBox it won’t work any longer.

Taking the Plunge: Upgrading

In the FoxyCart admin on your Store Settings page, put your new image logo in the “Logo URL” box and upgrade to 2.0. Then go to the FoxyShop settings and update your store to be FoxyCart Version 2.0. Now, go to your site and try to add something to the cart. Does Sidecart pop up? If not, open up your console and look for Javascript errors. You’ll also want to look at your FoxyCart includes and make sure they are pulling down the correct Sidecart includes and responsive_styles.css.

Go back to the FoxyCart admin and click on the new “Configuration” menu item under the templates section. Most of this is very self-explanatory. I do recommend clicking on “Customize Cart Display” and unchecking all but the first “Show Product Options.” You may also be interested in customizing what checkout fields are shown and what countries are allowed to check out. This used to be a script but it’s now built-in.

There are new versions of the shipping scripts which are required. If you need these and can’t find them in the wiki, contact FoxyCart support. If you want to add special fields to the checkout, the code can be entered right in the injection section.

Version 4.5: FoxyCart 2.0 Support

New Features in FoxyShop 4.5It’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.

(continue reading…)