Support » Plugin: WooCommerce » WooCommerce product_category shortcode customisation

  • Hello

    I am going to have a few pages that use [product_category category=”xxxxx”] in order to display products. I would like to add a “more info” box as well as change some of the HTML output of this shortcode slightly to make the products fit better on the page.

    Which PHP file & functions do I need to edit? I would imagine that the short-code calls a loop that then calls each product individually. The theme I am using (Mercor) does have lots of overrides so it may be that the layout is already customised a little, but I don’t know which functions to look at.



Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author James Koster


    I wouldn’t really recommend editing shortcodes. If all you want to do is add content which not add it to the category description?

    Changing markup is also dangerous. The layout should be controlled via CSS to it’s probably safer to adjust that rather than the markup.

    Thank you for the quick reply jameskoster. I really would like a button that says info next to the Add to Cart button, but I don’t think that could be done with CSS alone (although the rest can). I think I said box when I meant button.

    I can use a template override file so it will be easy to undo anything that does not have the desired affect. Do you know which PHP file I would need to use to create the template override?

    Ditto! I’d like a more info button taht links to the product page next to the add to cart button.

    Why not copy the code which creates the ‘product_category’ shortcode into your theme functions file, and name it something like ‘product_category2’ (or whatever you like). Then you can make the changes you desire, and the new shortcode will be protected from being overwritten by future woo updates

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WooCommerce product_category shortcode customisation’ is closed to new replies.