Remove prices from Variation drop-downs in Shopp WordPress plugin

Problem: In Shopp (1.1.9) the default variations drop-down list shows prices. This isn’t always desired. This is the default usage:

<ul class="variations">
  <?php shopp('product', 'variations', 'mode=multiple&label=true&defaults=Select an option&before_menu=<li>&after_menu=</li>'); ?>

And this outputs a list that shows options as “Option Label (price)”.

Fix: The code above can be replaced with this code to manually create the same thing, giving complete control over output:

<ul class="variations">
    <label for="options-1">Quantity</label>
    <select name="products[<?php shopp('product', 'id'); ?>][options][]" class="category-catalog product<?php shopp('product', 'id'); ?> options" id="options-1">
    <option value="">Select an option</option>
        while (shopp('product', 'variations')): ?>
        <option value="<?php echo $i;$i++; ?>"><?php shopp('product', 'variation', 'label'); ?></option>
    <?php endwhile; ?>

The $i;$i++ was a bit of a work-around as I couldn’t get it to work with variation ID, so if you know a better way, please tell us below!

5 thoughts on “Remove prices from Variation drop-downs in Shopp WordPress plugin”

  1. Also .. plagiarising a bit here but you could do something similar and create sans-price radio buttons (as opposed to a dropdown):

    $i = 1; while (shopp('product', 'variations')) { // Form the radio button name $id = shopp('product', 'id', 'return=true'); $name = "products[$id][options][]"; // The first field should be selected by default $selected = ($i == 1) ? 'checked="checked"' : ''; // Echo to screen echo ''; shopp('product', 'variation', 'label'); // Increment $i++; }

  2. I found a better way to do this. Here is the original code: <?php shopp('product', 'variations', 'mode=multiple&label=true&defaults=Select an option&before_menu=&after_menu=’); ?>

    Here is the revised code:

Leave a Reply

Your email address will not be published. Required fields are marked *