Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter christianguevara

    (@christianguevara)

    Done ??

    Thread Starter christianguevara

    (@christianguevara)

    Ohhh, A lot of Thanks Yordan, I’ts works ??

    Thread Starter christianguevara

    (@christianguevara)

    Hello,
    @kluver @alexmigf

    I have managed to call the function when someone marks the check option, but my WordPress gives me a fatal error, I don’t know if I’m putting it in the right place.

    The code I put in the function.php

    <!DOCTYPE html>
    <html>
        <head>
            <title>JavaScript CheckBox</title>
            <meta charset="windows-1252">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
            <script type="text/javascript" src="javascript.js"></script>
        </head>
        <body>
            <p class="form-row  thwcfd-field-wrapper thwcfd-field-radio" id="billing_invoice_field" data-priority="50">
                <label for="billing_invoice_invoice_yes" class="">?Quieres factura por la compra?&nbsp;
                    <span class="optional">(opcional)</span>
                </label>
                <span class="woocommerce-input-wrapper">
                    <input type="radio" class="input-radio " value="invoice_yes" name="billing_invoice" id="billing_invoice_invoice_yes">
                    <label for="billing_invoice_invoice_yes" class="radio ">Sí</label>
                    <input type="radio" class="input-radio " value="invoice_no" name="billing_invoice" id="billing_invoice_invoice_no">
                    <label for="billing_invoice_invoice_no" class="radio ">No</label>
                </span></p>
         
                 
        
            
        </body>
    </html>
    window.addEventListener('load', inicio);
    
    function inicio(){
    
    document.getElementById("billing_invoice_invoice_no").addEventListener("click", func1);
    
    }
        function func1()
        {
    /************Here would go the function that you have provided me**************/
    	}
    }

    }
    }`

    Thanks for help!

    Thread Starter christianguevara

    (@christianguevara)

    Hi @kluver @alexmigf,

    Thanks for the fast aswer, Despite of your help i can’t resolve my problem,

    I try to put your code on my web and add the function that calls a code that you put in the post to call the invoice, but it doesn’t work.

    You can tell me what I’m doing wrong.`

    I put my code in case you can help me.

    This is html

    <p class="form-row  thwcfd-field-wrapper thwcfd-field-radio" id="billing_invoice_field" data-priority="50">
        <label for="billing_invoice_invoice_yes" class="">
        ?Quieres factura por la compra?&nbsp;
         <span class="optional">(opcional)</span>
        </label>
        <span class="woocommerce-input-wrapper"><input type="radio" class="input-radio " value="invoice_yes" name="billing_invoice" id="billing_invoice_invoice_yes" checked="checked">
        <label for="billing_invoice_invoice_yes" class="radio ">Sí</label>
        <input type="radio" class="input-radio " value="invoice_no" name="billing_invoice" id="billing_invoice_invoice_no">
        <label for="billing_invoice_invoice_no" class="radio ">No</label>
        </span>
        </p>
    
        <p class="form-row form-row-wide thwcfd-field-wrapper thwcfd-field-text" id="billing_company_field" data-priority="60">
            <label for="billing_company" class="screen-reader-text">
                Nombre de la empresa&nbsp;
                <span class="optional">(opcional)</span>
            </label><span class="woocommerce-input-wrapper">
                <input type="text" class="input-text " name="billing_company" id="billing_company" placeholder="Nombre de la empresa" value="" autocomplete="organization" style="display: none;">
            </span></p>

    I want to send the invoice only if the client check.

    <label for="billing_invoice_invoice_yes" class="radio ">Sí</label>

    In in case that the client check no, don`t send it.
    <label for="billing_invoice_invoice_no" class="radio ">No</label>

    I add a conditional to call label and put in your code

    add_filter( 'wpo_wcpdf_custom_attachment_condition', 'wpo_wcpdf_send_invoice_on_customer_request', 100, 4 );
    
    //Conditional
    
    if ('invoice_yes' == get_post_meta($post->ID, 'billing_invoice_field', true)) { 
      function wpo_wcpdf_send_invoice_on_customer_request( $condition, $order, $status, $template_type ) {
        if ( $template_type == 'invoice' ) {
          $condition = $order->get_meta( 'invoice_yes' ) == 1 ? true : false;
        }
      
      }
    
    }
Viewing 4 replies - 1 through 4 (of 4 total)