Support » Plugin: WooCommerce Product Stock Alert » New Fild ( Phone )

  • Resolved jorgecal

    (@jorgecal)


    Is it possible to add one more field (phone number) so that when subscribing to the product with the email, it is also possible to put the phone number?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author WC Marketplace

    (@wcmp)

    Hi @jorgecal, thanks for getting in touch with us.

    Currently, there are no such default settings for you to add extra fields.
    However, you can do custom code and add these fields.

    Do you have any developers so we can guide them?

    Thread Starter jorgecal

    (@jorgecal)

    Hello ,

    No .

    Cam you do this ?

    Tks

    Plugin Author WC Marketplace

    (@wcmp)

    Hi @jorgecal, we would love to help you out.

    However, this will take a good amount of custom code. Kindly contact our tech team so they can guide you over the forum : https://wc-marketplace.com/support-forum

    pkollias

    (@pkollias)

    Hello @wcmp , i am developer and would like to add extra field to the form for my website. How can you guide me please? Can we use hooks/filters? Or maybe change functions? Thank you

    Plugin Author WC Marketplace

    (@wcmp)

    Hi @pkollias, there are two hooks before and after above form. Those are do_action('woocommerce_product_stock_alert_form_after'),do_action('woocommerce_product_stock_alert_form_before')

    Use these hooks to add extra fields. We don’t save alert form data. So use those hooks to add an extra field and save that field in a variable and pass that in the mail using the hook apply_filters( 'woocommerce_email_footer_text')

    Hello @wcmp , thank you for your guidance.
    I am able to display the field, and move it with jquery, but i can’t display it to the emails. Here’s what i did so far:

    add_action( 'woocommerce_product_stock_alert_form_after', 'woocommerce_product_stock_alert_form_phone_field' );
    function woocommerce_product_stock_alert_form_phone_field(){
    ?>
    <input id="alert_phone_input" type="text" pattern="[0-9]+" class="stock_alert_phone" name="alert_phone" placeholder="<?php _e('Enter your mobile phone number', 'woocommerce-product-stock-alert'); ?>"/>
       
    <script type="text/javascript">
        jQuery( function($){
           $("#alert_phone_input").insertAfter('.stock_alert_email');
        });
        </script>
    <?php
    }
    
    add_action( 'woocommerce_email_footer', 'woocommerce_email_footer_phone_field' );
    function woocommerce_email_footer_phone_field(){
    $alert_phone = '';
    if ( ! empty($_POST['alert_phone'])){
    $alert_phone = $_POST['alert_phone'];
    }
    ?>
    <p>
    <strong><?php esc_html_e( 'Mobile phone number', 'woocommerce-product-stock-alert' ); ?> : </strong>
    <span><?php echo $alert_phone; ?></span>
    </p>
    
    <?php
    }
    Plugin Author WC Marketplace

    (@wcmp)

    Hi @pkollias, our team is checking your query.

    Kindly provide them sometime.

    Plugin Author WC Marketplace

    (@wcmp)

    Sorry for the delayed reply.
    It seems like you haven’t saved the custom data in the database. So first save the data there, and then display the same in the mail.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘New Fild ( Phone )’ is closed to new replies.