• Resolved alfaex

    (@alfaex)


    I sell virtual products, and i don’t mind from where someone is buying.
    i don’t need to shipping nothing, or apply any tax.

    I’m not using the woocommerce default checkout fields, i’m building my own and using a typeahead to populate address base on my CRM, i need the id from the street, postal code and etc.

    When i’m typing on the fields, woo fires update_order_review and messes with my typeahead.
    The form to select the payment method show grayed out.
    And i can’t select a payment method

    I can’t find a way to disable this behaviour

    https://wordpress.org/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Thread Starter alfaex

    (@alfaex)

    thanks @icaleb

    I didn’t know about these .js files, so instead of remove the entire script, i went to see when the event is created, and i found this.

    $( document.body ).bind( 'update_checkout', this.update_checkout );

    After reading a little, i found that I will not be able to unbind because of the namespace, so i hooked up on the on event and since i can’t prevent default i stoped the propagation of the event.

    and these solved my problem.

    jQuery(document.body).on('update_checkout', function(e){
    	//e.preventDefault();
    	//e.stopPropagation();
    	e.stopImmediatePropagation();
    	//console.log(e);
    });

    This issue needs reporting as a bug.

    Been banging my head against a brick wall all day trying to figure out why removing required fields with various filters had no effect.

    Finally figured out it’s this update_order_review call.

    Thread Starter alfaex

    (@alfaex)

    if you want to remove a field or make not required read this.

    Customizing checkout fields

    you can

    unset($fields['order']['order_comments']);

    or

    $address_fields['address_1']['required'] = false;

    That’s not the issue.

    Unless you customize address fields using the “woocommerce_default_address_fields” filter, any changes you make to address fields will be overridden once the javascript update_order_review takes over and each form is updated after the ajax call on checkout.

    You can update woocommerce_billing_fields, woocommerce_shipping_fields and woocommerce_checkout_fields all you like, but if you’ve edited any of the address fields, you’re wasting your time.

    You might say “what is the problem?”

    If you want different required address fields on billing and shipping forms, you can’t have them. I don’t want any address fields required on my shipping form, for various reasons, but in order to make this happen I need to remove the required fields on the billing form too. Not ideal.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘disable ajax update_order_review’ is closed to new replies.