Auto Populate Email Subject from Woocommerce Product

Amateur with programming (and love it), long time reader and first time poster.

I have set up a Woocommerce cart here at http://centrowireless.com/inventory/. I have a Contact for Price button made with the WP Call for Price plugin. I have made some customizations by changing the text to “Contact for Price”, adding a div for some CSS and adding a mailto when the button is clicked:

Read More
public function empty_price($price) { return '<div class="contactproduct"><a href="mailto:offers@centrowireless.com">Contact for Price</a></div>'; }

My question is, how can I auto populate the subject of that email so that the subject is the specific product the clicked button is a part of?

Thank you,

Evan

Related posts

Leave a Reply

2 comments

  1. This code is working for me, please give it a try:

    public function empty_price($price) {
        global $post;
        return '<div class="contactproduct"><a href="mailto:offers@centrowireless.com?subject='.urlencode($post->post_title).'">Contact for Price</a></div>';
    }
    
  2. I’d imagine that simply

    <?php the_title(); ?>
    

    would work just fine. Here’s an example:

    <a href="mailto:my@email.com?subject=<?php the_title(); ?>">Contact for Price</a>