1. Home
  2. Docs
  3. Checkout Countdown for WooCommerce
  4. How to
  5. Place Checkout Countdown Shortcode in templates or hooks

Place Checkout Countdown Shortcode in templates or hooks

Do you want to place the Checkout Countdown for WooCommerce in a custom location, such as inside the template files of your theme or using a hook? It’s simple.

All you need is to paste do_shortcode('[cc-countdown]'); where you’d like to display the countdown. Below is an example hook which fires at the top of the WooCommerce checkout page. It will allow you to further customize the Countdown, compared to using the standard option of displaying the countdown inside a WooCommerce Notice.

	
add_action( 'woocommerce_checkout_before_customer_details', 'extra_before_customer_details');

 function extra_before_customer_details() {
			 echo do_shortcode( '[cc-countdown]' );
 }

You should always useĀ do_shortcode(''); when placing any WordPress shortcodes outside the WP Editor, e.g through PHP functions and hooks like above.

You can read more about the do_shortcode function over at the WordPress Developer documentation.
Here is a direct link https://developer.wordpress.org/reference/functions/do_shortcode/

Was this article helpful to you? Yes No