dramasea
dramasea

Reputation: 3490

How to show only certain data in the woocommerce product page shortcode

i want to use the product page shortcode to add woocommerce product to my wordpress post. What I want to show is only the title, product image and the short description but not the whole product page. Is there any way I can achieve this?
http://docs.woothemes.com/document/woocommerce-shortcodes/#section-11

Upvotes: 0

Views: 1263

Answers (1)

Dre
Dre

Reputation: 2953

The product shortcode includes the content-product.php - this leaves you with a couple of options. You can either:

  1. Override this template with your on template by copying it to your theme folder
  2. Or you can unhook some of the actions that load the the various parts of the page. For example, if you wanted to remove the ratings tab, you can use remove_action() like so:

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );

A full list of all the hooks can be found in woocommerce/includes/wc-template-hooks.php

Please note that either of these actions will affect all product ages, not just the ones rendered with the shortcode. If you want to change just the pages rendered via shortcodes then your best bet is to copy and edit the template as required (as per option 1 above) but save it in your theme folder with a different name (something like content-product-short.php). Then create your own shortcode function that fetches your new template - look at the function inside class-wc-shortcodes.php to get the idea.

Upvotes: 0

Related Questions