Title: Action Hook in a shortcode
Last modified: August 21, 2016

---

# Action Hook in a shortcode

 *  [daileycon](https://wordpress.org/support/users/daileycon/)
 * (@daileycon)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/action-hook-in-a-shortcode/)
 * I’m using the Cart Notices extension and I want to use one of the shortcodes 
   on the product page. Would adding this to the functions.php file work?
 * add_action(‘woocommerce_before_single_product’, ‘my_function_name’);
 * function my_function_name() {
    echo do_shortcode(‘[woocommerce_cart_notice]’);}
 * I would like to embed this notice(shortcode) without editing the template file.
   I know there has to be a simple way to do this.
    Thanks
 * [http://wordpress.org/extend/plugins/woocommerce/](http://wordpress.org/extend/plugins/woocommerce/)

The topic ‘Action Hook in a shortcode’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [daileycon](https://wordpress.org/support/users/daileycon/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/action-hook-in-a-shortcode/)
 * Status: not resolved