get current product name in functions.php

i create a button in a current product page after woocommerce_single_product_summaryi would to get information about the

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 ?

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 ?

Share Improve this question asked Jun 13, 2019 at 0:37 riccardo aironericcardo airone 1131 silver badge4 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

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>'; 
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745406772a4626348.html

相关推荐

  • get current product name in functions.php

    i create a button in a current product page after woocommerce_single_product_summaryi would to get information about the

    5小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信