Looking to insert a WooCommerce product price into a layout, well you can add the WooCommerce Product Price as a shortcode using the product ID as an attribute for the correct product.

The code below goes into your functions.php file, the add the shortcode where you need to display the price.

add_shortcode( 'cl_product_price', 'cl_woo_product_price_shortcode' );
 * Shortcode WooCommerce Product Price.
function cl_woo_product_price_shortcode( $atts ) {
	$atts = shortcode_atts( array(
		'id' => null
	), $atts, 'cl_product_price' );
	if ( empty( $atts[ 'id' ] ) ) {
		return '';
	$product = wc_get_product( $atts['id'] );
	if ( ! $product ) {
		return '';
	return $product->get_price_html();

And use the shortcode in the layout/template with the Product ID number as an attribute.

[cl_product_price id="1011"]


  1. Shaun Pan on June 29, 2020 at 1:37 am

    Great contribution work fine using product ID.
    –Dynamic price required instead of ID grab.
    But I am using in blocks lightbox pop up and I have twenty products with different prices, when user click link button the module show the same price for every product, I want see the module display the current product page price on popup blocks.
    Any help will be much appreciated.

  2. Stuart on June 5, 2020 at 10:23 am

    Is there a way to do this dynamically so instead of using an id it grabs it from the product page?

  3. V on May 18, 2020 at 11:00 am

    You already know that woocommerce has 2 prices, normal price and reduced price.
    Could it be that only the discounted price is displayed?

    Thank you!!

  4. V on May 18, 2020 at 10:42 am

    Worked perfectly!!!!

    I´m so happy =) =) =)

    Great thanks!!

  5. Sónia Dias on April 13, 2020 at 11:28 am

    Hi Lewis,

    I’ve tried using elementor but it doen’t work. :(

  6. lewis on March 7, 2020 at 12:31 am

    Worked Perfectly! Thank you for this code.

Leave a Comment