1

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 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.