Riccardo
Riccardo

Reputation: 356

woocommerce checkout country

Hi and thanks in advance for any help,

I need to debug the woocommerce checkout page in which some fields of the form billing are not aligned correctly for some countries. i saw that the issue is resolved if i add a after the postcode field, the function woocommerce_form_field( $key, $args, $value = null ) adds that div if $args['clear'] is not empty and it's called in a foreach for the checkout page in the checkout/form-billing.php file. woocommerce_form_field(...) is in woocommerce/includes/wc-template-functions.php.

The $args contains the clear attribute correctly and woocommerce_form_field returns the field with div correctly (mailed myself the data from the function), when i get to the page the div is not there and fields are not aligned. Also i noticed that if i try to echo something it doesn't appear on the page source but if i mail the data from the same form-billing.php spot the data is received correctly. How can i make the div show correctly ? What javascript could rewrite the form and where can i edit it ?

the fields disaligns if you select United States in the country select. Any suggestion would be appreciated

P.S.: i added some javascript that adds the div on document.onload but it feels dirty and i'm not sure it works in every case.

EDIT: rephrase, clarify

Upvotes: 0

Views: 1564

Answers (1)

funkysoul
funkysoul

Reputation: 3241

To be safe when updating woocommerce in future versions you should do the following:
Best is to replace checkout.min.js with your own modified version.

Placing this in your functions.php should load your modified script

$wp_scripts->registered[ 'wc-checkout' ]->src = get_stylesheet_directory_uri() . '/js/yourmodifiedcheckout.js';

Hope this helps, let me know if you need further help.

Upvotes: 1

Related Questions