How can I get quantities in a dropdown on the product page?

Here’s some code to help you get quantity ranges (like 10, 50, 100) in a dropdown on the product page. Put this code in your functions.php file. Then in your single product template, change the product variations function to read:


Add that second function after it. Then you can add your quantity ranges separated by comma in the new “Qty Groups” box on the product entry page.


Remove Rewrites and Automatic URL’s

If you want to remove all template redirect rewrites, the following code placed in your functions.php file should take care of it for you (since version 4.2).

remove_action('template_redirect', 'foxyshop_theme_redirect', 1);
add_filter('foxyshop_register_post_type', 'my_foxyshop_register_post_type');
function my_foxyshop_register_post_type($args) {
	$args['public'] = false;
	return $args;

Capability-Based Pricing

FoxyShop user Jacob Dubail submitted this helpful script for capability-based pricing: This script would go in the functions.php file.

Require that users be logged in before viewing any product pages

If you’d like to make sure that your users are logged in before viewing any product pages you can place the following code snippet in your functions.php file:

Currency Conversion

FoxyCart doesn’t support multiple currencies, but if you want to let your users do their own currency conversion on the product page, here is some code that will help you get started: This script will let the user query Google’s currency conversion tool for the product price. Paste this code in your foxyshop-single-product.php template file. Then, you’ll need to save this code as ajax_converter.php and put it in your theme folder.

Open Product Detail Pages in a Modal Window

If you want to open your detail pages in a modal window from the category page, you’ll want to remove the get_header() and get_footer() calls from the foxyshop-single-product.php template file and add this to the jQuery script section of foxyshop-single-category.php. Only tested in 0.7.2.

$(".foxyshop_product_list .foxyshop_product_box a").each(function() {
    $(this).attr("href", $(this).attr("href") + "?modal=true")
$(".foxyshop_product_list .foxyshop_product_box a").colorbox();
$("form.foxyshop_product").submit(function() {

You may also want to consider adding writing a conditional into the foxyshop-single-product.php template to check for the isset($_GET['modal']) querystring variable so that direct links to the product pages will still show a nicely formatted page.

Add Custom Fields to Products

You can add checkboxes, text fields, or anything else to your product details meta box. Add this code to your functions.php as a starting point.

Show a Table of Discounts

Here’s a function that will show your customer a table of discounts that will be applied for quantity purchases. Note that this table is looking for Discount Quantity Amount only.

Show Price Range

Here’s a function which you can stick in your functions.php file to show the price range for a product. The function looks through all the variations for a particular product and checks for high and low prices. When it finishes, it spits out a string like “$15.00 – $19.00”. You can comment out the foxyshop_price() in foxyshop-product-loop.php and put echo my_high_low_price($product); in its place. Download the code here.

Put the Category Name in the Product URL

If your SEO requirements call for putting the category slug in the product URL, this is possible. Doing this, will break some internal functions and the product View and Preview buttons from the admin will no longer work. First, put this code in your wp-config.php file:


This rewrites the slug so that it includes the product category (if you have multiple cagegores, it picks one). Secondly, put this code in your theme’s functions.php file. Your product URL’s will now look like this: