By riccardo airone


2019-06-13 00:37:30 8 Comments

i create a button in a current product page after woocommerce_single_product_summary

i would to get information about the current product ( for example name and price) and through the button send an email for get information

this is the code of my functions.php file:

add_action( 'woocommerce_single_product_summary','content_after_addtocart_button' );

function content_after_addtocart_button() { 
echo '<div class="content-section">
<a href="mailto:[email protected]?&subject= Richiesta Informazioni&body= product name ??? product price ??? ">
<input type="button" value="Richiedi Informazioni"/ ></a></div>'; 
}

anyone can help me ?

1 comments

@Milan Hirpara 2019-06-13 04:28:28

Please check below code :

add_action( 'woocommerce_single_product_summary','content_after_addtocart_button' );
function content_after_addtocart_button() { 

    global $product;

    $product_title = $product->get_name();
    $product_price = $product->get_price();

    echo '<div class="content-section">
    <a href="mailto:[email protected]?&subject=Richiesta Informazioni&body=' . $product_title . '??? ' . $product_price . ' ??? ">
    <input type="button" value="Richiedi Informazioni"/ ></a></div>'; 
}

Related Questions

Sponsored Content

4 Answered Questions

[SOLVED] Woocommerce: Variable Product - get variation name

  • 2019-07-16 09:59:48
  • Oscar S.
  • 355 View
  • 0 Score
  • 4 Answer
  • Tags:   woocommerce

1 Answered Questions

1 Answered Questions

[SOLVED] Get current post id in functions.php

1 Answered Questions

[SOLVED] Woocommerce - remove product from category

1 Answered Questions

[SOLVED] Retrieve Product category 'NAME' by product category ID - WooCommerce?

1 Answered Questions

[SOLVED] Get current page_id before loop, in functions.php

2 Answered Questions

[SOLVED] Multiple pages on one with different HTML

  • 2013-05-21 15:28:07
  • James
  • 2081 View
  • 0 Score
  • 2 Answer
  • Tags:   php css html

Sponsored Content