Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

How can I filter the output of the woocommerce 'product categories' shortcode. I need to add a button into each product in the loop.

Docs WooCommerce: Product Categories shortcode

WooCommerce code source (github): class-wc-shortcodes.php

It should work. The syntax is strange for me and I'm not sure about how I am supposed to change {$product_categories} syntax code in it:

function add_html_to_shortcode_product_categories() {

  echo '<a class = "cta_btn" href="#">shop now</a>';

}

add_action('woocommerce_shortcode_after_{$product_categories}_loop', 'add_html_to_shortcode_product_categories', 20);

Some help would be greatly appreciated.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.