How to solve loading issue while select payment method on checkout page in wordpress.

How to solve loading issue while select payment method on checkout page in wordpress

WordPress checkout issue

If you are wordpress user and working on checkout page then you must be getting this error once a time.

Checkout page where customer have an option to select different different payment method and they are using their suitable payment method.

Now the owner of an e-commerce website created different different shipping charges based on payment method and pincode OR they have integrated any shipping plugin based on payment method.

That mean whenever user will select payment method the charges will be updated based on given condition but what is required to see that effect.

The Loader

Yes if the loader does not load then how the customer will see the changes in price. so this is the issue we are getting when some of the theme not supported the loader or it have not the loader script.

So here is the script which to enabled the loader on checkout page while changing the payment method.

You have to put this script on function.php file to enable this.

add_action( 'wp_footer', 'enqueue_smartcod_js', 100 );

function enqueue_smartcod_js() {
	ob_start(); ?>
	<script type="text/javascript">
	jQuery( document ).ready( function($) {
		$( 'body' ).on( 'change', 'input[name=payment_method], #shipping_state, #billing_state', function() {
			$( 'body' ).trigger( 'update_checkout' );
		});

		$( 'body' ).on( 'focusout', '#billing_postcode, #shipping_postcode, #shipping_city, #billing_city', function() {
			$( 'body' ).trigger( 'update_checkout' );
		});
	})
	</script>
	<?php
	ob_end_flush();
}

If you still have an issue, Please do comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *