How to Hide Pricing on Product and Category templates using Shopp

This is a pretty common problem that someone came to me with to help them solve their issue with using the Shopp plugin and not being able to hide pricing on products that had a “$0.00″ value associated to them.  Some common use cases that you can address by using this workaround include…

  • Having “Call for Pricing” field visible
  • Hiding or all together removing the price from a product
  • If you have special or bulk pricing options in an item – normally this means that you want people contacting you for bulk order pricing or a wholesale price

I’ll show you the logic that you can use to implement on both of these use cases involving the Shopp plugin for WordPress so I hope that you enjoy this “how-to” article.

I wanted to address a problem that I helped solve for a client of mine recently where they wanted to remove (aka hide) the price of a $0.00 product.  They were using the Shopp plugin for WordPress which I’ve blogged about a few times before on here.  Feel free to read my articles about customizing for the Shopp plugin…

  1. Using “tagged” tags on the Product.php Template in Shopp
  2. How to Add Descriptions to Category Layouts in Shopp
  3. How to Customize the Shopp Checkout.php Template for WordPress

… Okay, so getting back to the issue, I had to find a way to disable price if the amount was for a $0.00 product.  Normally there are a number of reasons why a product would be marked as $0.00 on an ecommerce website including…

All of these are good reasons as to why you might want a price to be hidden or unavailable on your ecommerce site.  One option that was initially suggested was to use the “tagged” tag and for all intensive purposes this would have been a good workaround except that you cannot write logic in the “tagged” tag to accommodate this.  I wrote an article about using the tagged tag when working with the Shopp ecommerce plugin for WordPress so please read it if you are interested in more information about using this functionality.

The “tagged” tag would be a good option if you want to tag a product as “callforprice” and it would spit out “Call for pricing” on the product however in this case because we are looking at prices themselves this simply wouldn’t work because the support for using conditional statements like “if then else”.  I came up the following code to look at the price to determine if a $0.00 product existed and if it did then apply a certain behaviour to it depending on the condition that was met…

//Looks to see if the price is equal to $0.00

<?php if (shopp(‘product’, ‘price’,’return=true’) == “$0.00″) {

//Shows nothing

echo “”;

} else {

//Else, if the $0.00 price is not met then show price

shopp(‘product’,’saleprice’,’starting=from’,’return=true’);

}

?>

As you can see it’s pretty straight forward and you can see it in action below with some before and after screenshots for customizing the product.php template for Shopp…

Before adding the coding

After adding in the code

Some other things that this logic could also address are looking at products between a specific range of prices or greater then a specific value like high value items that you want to have people call you about before selling to your customers.  There are a number of scenarios where it would make sense to use logic like this on your ecommerce store.  Now, for the other part of this article I wanted to talk about how you can apply similar logic to the category.php template in Shopp to do the same thing because chances are if you wanted to hide the price on the products you’d want to hide them in the category view as well.

Customizing the Category.php template to hide the price in Shopp

Customizing the Category.php file for the Shopp Plugin was a little trickier because you need to use if statements and do nested if statements inside to get it working just right.  Check out the coding below to see what I am talking about…

//Looks to see if the price is equal to $0.00

<?php if (shopp(‘product’, ‘price’, ‘return=true’) == “$0.00″) {

//Shows nothing

echo “”;    }

else {

//Else, show the pricing on categories

shopp(‘product’,’saleprice’,’starting=from’);    } ?>
<?php if (shopp(‘product’,’has-savings’)): ?>

<p>Save <?php shopp(‘product’,’savings’,’show=percent’); ?></p>

<?php endif; ?>

Have a look at the finished product below to see what the finished look is like when customizing the Category.php template in the Shopp plugin for WordPress

Before adding the coding

After applying the coding

If you’ve bought the Shopp ecommerce plugin for WordPress what I can tell you is that there are many ways to accomplish a lot of functionality requests if you have the time, ability to code and patience but if you’ve got questions feel free to post them below and we’ll see if we can’t answer a some of them.

Customizing ecommerce websites is sometimes not the easiest thing you can do but regardless of what your ecommerce website runs on whether its the Shopp ecommerce plugin for WordPress, Magento or something else, if you know enough about coding or know someone who can help you then you can accomplish almost anything!

 

Comments

  1. says

    Luc….great job with this.

    I have been looking for ways to add a button that would say see price and then redirect visitors to Amazon with my affiliate link embedded for similar products we offer. I will try and use some of this.

  2. says

    I was just wondering if you removed anything or just stuck this code and it worked…I just stuck the code into the category.php page and I keep getting an error because of the endif.

  3. ty says

    This is great. Do you know how to remove the prices from the addons or variations dropdowns?

    Thanks!

  4. says

    Hey Luc,
    great idea. Unfortunately this is not working for me right now.
    Any troubleshooting experiences on this one?
    Thx, Torben

  5. says

    Hey Luc;
    I’m having a problem with shopp where the prices will show up on the category page but they come up as $0.00 on the product pages.

    I call the product price using but it doesn’t seem to be associating with the correct price like the category page or the side bar.

    Any thoughts?

  6. James Devon says

    Hi Luc,

    Thanks for this very nice post. I was wondering if you can post or advise on making the Shopp plugin checkout form some sort of a “request for quote” form; with the payment system and all other fields related to payment process disabled.

    Thank you for your time.

Leave a Reply

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

This blog is kept spam free by WP-SpamFree.