WP e-Commerce Show Widgets in Store Pages Only

shopping-cart-widgetNot all WP e-Commerce enabled websites require a shopping cart or product categories list on each page. Some sites have a blog section separate from the online store. Widget Logic does a great job of conditionally loading widgets using WordPress’ normal conditional tags but requires special tags for wpec-products post type.

For this reason I had to add another plugin called Dynamic Widgets which has build in integration for WP e-Commerce pages.  The only problem with this is that Dynamic Widgets significantly slows page loading according to a plugin profiler I use to test with.


My life would be much much easier if I could use Widget Logic only. After doing a lot of research I have found the perfect logic that works with WP e-Commerce. This is how to show widgets in store pages only:

Use this code to load widgets in single products, product tags, categories and variations:

is_singular('wpsc-product') || is_tax( 'product_tag' ) || is_tax( 'wpsc_product_category' )|| is_tax( 'wpsc-variation' )

When you first install WP e-Commerce it automatically creates pages. Use this code to load widgets in the default pages along with the pages above.

is_page( array( 'products-page', 'checkout', 'your-account', 'transaction-results' ) ) || is_singular('wpsc-product') || is_tax( 'product_tag' ) || is_tax( 'wpsc_product_category' ) || is_tax( 'wpsc-variation' )

If you did everything right you can now selectively load widgets like a shopping cart or product categories navigation only in the shop pages.

Share this if you found it useful. Reply in the comments to leave feedback.

Like, Tweet and Share!

Comments are closed.
Published Last updated