• Resolved jansku

    (@jansku)


    Hi,
    How is’s possible to refresh payment- and shipping-methods only with postcode.
    Now address field make refresh.

Viewing 4 replies - 1 through 4 (of 4 total)
  • This is a problem. When changing the postal code the shipping methods do not update. When updating the postal code the correct is to expand the shipping options for the customer select the most appropriate, if there is more than one.

    Sorry my english.

    gustavolessa

    (@gustavolessa)

    I have the same problem!

    When the user finishes filling in the shipping address, the shipping methods do not update.

    Shows the message that there are no delivery methods available.

    It just updates the delivery method when i go to the next step.

    Sorry my english.

    Plugin Author Diego Versiani

    (@diegoversiani)

    Hi @jansku, @mixbee, and @gustavolessa,

    You can use the code snippets below to make the postcode field — along with the city and state fields — trigger updating the checkout sections.

    /**
     * Change shipping field attributes to trigger checkout update.
     */
    function fluidcheckout_change_shipping_address_fields_args( $fields ) {
    	if ( array_key_exists( 'shipping_state', $fields ) ) { $fields[ 'shipping_state' ][ 'class' ][] = 'update_totals_on_change'; }
    	if ( array_key_exists( 'shipping_city', $fields ) ) { $fields[ 'shipping_city' ][ 'class' ][] = 'update_totals_on_change'; }
    	if ( array_key_exists( 'shipping_postcode', $fields ) ) { $fields[ 'shipping_postcode' ][ 'class' ][] = 'update_totals_on_change'; }
    	return $fields;
    }
    add_filter( 'woocommerce_shipping_fields', 'fluidcheckout_change_shipping_address_fields_args', 300 );
    
    /**
     * Change billing field attributes to trigger checkout update.
     */
    function fluidcheckout_change_billing_address_fields_args( $fields ) {
    	if ( array_key_exists( 'billing_state', $fields ) ) { $fields[ 'billing_state' ][ 'class' ][] = 'update_totals_on_change'; }
    	if ( array_key_exists( 'billing_city', $fields ) ) { $fields[ 'billing_city' ][ 'class' ][] = 'update_totals_on_change'; }
    	if ( array_key_exists( 'billing_postcode', $fields ) ) { $fields[ 'billing_postcode' ][ 'class' ][] = 'update_totals_on_change'; }
    	return $fields;
    }
    add_filter( 'woocommerce_billing_fields', 'fluidcheckout_change_billing_address_fields_args', 300 );

    If you are unsure about how to add the code snippet, check our article:
    How to safely add code snippets to your WooCommerce website

    Please note that the Country field needs to have a valid value for the other fields to trigger the checkout section update. This is how the WooCommerce script works.

    I’m closing this topic for now. If you need further assistance, please reply to this topic.

    Best,
    Diego

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Payment- and shipping -methods refresh’ is closed to new replies.