pass a woocommerce product name to contact form7?


i want to pass the product name to contact form as a parametre
there is a plugin do that but it open it in poppup and thats i don’t want
i want it to open a form
this is the Plugin: WooCommerce Quote or Enquiry Contact Form 7
and i find a short code that do perfectly but the button created i wanna renamed to ‘DEMANDE DEVIS’
and nothing change else
or i wanna this short code work on the add_to cart_button
// add inquiry button into every product
// we use the same hooks as before, to insert the new content on the same spot
add_action( ‘woocommerce_after_shop_loop_item’, ‘prfx_add_inquiry_button’, 10); // catalog page
add_action( ‘woocommerce_single_product_summary’, ‘prfx_add_inquiry_button’, 30); // single product page
function prfx_add_inquiry_button() {

$current_product_id = get_the_ID(); // get ID of the current post
$current_product_title = get_the_title(); // get the title of the current post

$product = wc_get_product( $current_product_id ); // get the product object

// create a button for variable/variant products
if ($product->is_type( 'variable' )) {

    $variations = $product->get_available_variations(); // get all available variations of the current product

    if ($variations) {
        foreach ($variations as $variation) {

            if ($variation['variation_is_active'] == 1) {

                echo '<div>';

                // use this to see all available data
                // print_r($variation);

                $variation_price_html = $variation['price_html']; // variation price html, for example "€150,00 incl. vat"
                $variation_id = $variation['variation_id']; // variation ID, for example "2006"
                $variation_title = get_the_title( $variation_id ); // variation title, for example "Beanie with Logo - red, medium"

                // we create a button for each single available variation
                echo '<a href="'.home_url('/demande-devis').'/?product-title='.$variation_title.'" class="button">';

                    echo $variation_title; // show title
                    echo '<br>';
                    echo $variation_price_html; // show price html

                echo '</a>';

                echo '</div><br>';



// create a button for simple products
} elseif ($product->is_type( 'simple' )) { 

    echo '<a href="'.home_url('/demande-devis').'/?product-title='.$current_product_title.'" class="button">';

        echo $current_product_title;

    echo '</a>';


please heeeeeeeeeeeelp

Mahjoubi houssem 1 month 0 Answers 10 views 0

Leave an answer