Search Documentation

How do I add the show/hide visibility template tag to my template files?

This tutorial assumes you have WP e-Commerce 3.8.8 or above installed and activated within your WordPress site. It also assumes you have copied the WP e-Commerce template files to your WordPress Theme directory by following the steps explained on Settings > Store > Presentation within the WordPress Administration.

To toggle visibility of Products via the Show/Hide Products dropdown you must add a conditional template tag to the Products Page and Single Product detail template files. Since we’re using a conditional template tag you can choose to show/hide different elements or the whole Product entirely. This tutorial assumes you wish to hide the Price, Add to Cart and Quantity elements. To do this:

  1. Open your current WordPress Theme directory with your preferred FTP manager, by default this is: /wp-content/themes/[…]/…
  2. Open wpsc-products_page.php, this is the Products Page template file which we will be adding our conditional template tag to.
  3. Find the line starting ‘<form […]>’ (this is line #126 in WP e-Commerce 3.8.8.3)
  4. Above this line add a new line pasting the following: <?php if( wpsc_wp_is_product_visible() ) : ?>
  5. Find the line starting ‘<form><!–close product_form–>’ (this is line #216 in WP e-Commerce 3.8.8.3)
  6. Below this line add a new line pasting the following: <?php endif; ?>
  7. Save and upload changes to wpsc-products_page.php
  8. Open wpsc-single_product.php, this is the Single Product template file which we will be adding our conditional template tag to.
  9. Find the line starting ‘<form […]>’ (this is line #77 in WP e-Commerce 3.8.8.3)
  10. Above this line add a new line pasting the following: <?php if( wpsc_wp_is_product_visible() ) : ?>
  11. Find the line starting ‘</form><!–close product_form–>’ (this is line #193 in WP e-Commerce 3.8.8.3)
  12. Below this line add a new line pasting the following: <?php endif; ?>
  13. Save and upload changes to wpsc-single_product.php

Note: If you are using Gold Cart’s Grid view or Product list view you will need to also add this conditional template tag to wpsc-grid_view.php and wpsc-list_view.php respectively.