Echo product title in woo commerce

At the bottom of every product I want to add the sentence:

Any Questions about “Product Name”, get in touch with us

Read More

The code I’m using is

<h1>Questions about <?php the_product); ?> get in touch</h1>

This however doesn’t seem to work, how do I pull the product name in Woocommerce?

Related posts

Leave a Reply

7 comments

  1. It’s outdated question, but if anybody is looking like me these days:

    <? echo $product->post->post_title; ?>
    

    or get full html title element:

    <? echo woocommerce_template_single_title(); ?>
    

    Works for Woocommerce 2.5+

  2. Please try this line

    <h1>"Any Questions about "<?php echo $the_product; ?>", get in touch with us"</h1>
    

    Note that echo use to print the PHP variables value, and every variable in PHP have $ before its name like $the_product.

  3. Here is what I use for my product page markups.

    <script type="application/ld+json">{
    	"@context": "http://schema.org/",
        "@type": "Product",
        "name": "<?php echo the_title(); ?>",
        "category": "Designer Fashion Boutique",
        "description": "Designer Clothing Store and Online Fashion Boutique",
    	"url": "<?php the_permalink(); ?>"},
            
    </script>
  4. <?php $args = array('post_type' => 'product',
                    'posts_per_page' =>-1);
                    $loop = new WP_Query( $args );
                if($loop->have_posts()){
                            while ( $loop->have_posts() ) : $loop->the_post(); global $product; echo $product->get_title(); 
    endwhile;?>