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('[checkout_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.

// Place the Checkout Countdown before the customer details on checkout
function puri_before_customer_details() {
	echo do_shortcode( '[checkout_countdown]' );
add_action( 'woocommerce_checkout_before_customer_details', 'puri_before_customer_details');

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

Was this page helpful?