• philword2

    (@philword2)


    Hello!

    I have multivendor store, using plugin WC Vendor.
    I create in a product page new TAB with contact form.
    Possible to make function that will sand emails to each vendor email?

    I use this code for tab:

    add_filter( 'woocommerce_product_tabs', 'product_enquiry_tab' );
    function product_enquiry_tab( $tabs ) {
    
        $tabs['test_tab'] = array(
            'title'     => __( 'Задать вопрос продавцу', 'woocommerce' ),
            'priority'  => 70,
            'callback'  => 'product_enquiry_tab_form'
        );
    
        return $tabs;
    
    }
    function product_enquiry_tab_form() {
        global $product;
        //If you want to have product ID also
        //$product_id = $product->id;
        $subject    =   "".$product->post->post_title;
    
        echo "<h2>".$wcvendor."</h2>";
        echo do_shortcode('[contact-form-7 id="2834" title="Вопрос о продукте"]'); //add your contact form shortcode here ..
    
        ?>
    
        <script>
        (function($){
            $(".product_name").val("<?php echo $subject; ?>");
        })(jQuery);
        </script>
        <?php
    }

    and contact form code:

    <p>Ваше Имя (обязательно)<br />
            [text* your-name] </p>
    
        <p>Ваш E-mail (обязательно)<br />
            [email* your-email] </p>
    
        <p class="product_subject">Товар<br />
            [text your-subject class:product_name] </p>
    
        <p>Ваш вопрос<br />
            [textarea your-message] </p>
    
        <p>[submit "Задать вопрос"]</p>

    https://wordpress.org/plugins/contact-form-7/

The topic ‘CF7 for marketplace’ is closed to new replies.