0
votes

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

1
Can you try to rephrase this? What are you specifically trying to do? What have you done so far? What are you seeing versus what you are expecting? - helgatheviking
i'm trying to add a <div class="clear"></div> at the end of a field in the woocommerce_billing_form, it looks like the form is somehow rewritten live erasing the html/php edits that i add to the page. There is a country select that changes the input fields based on the country. I've now spotted a javascript script with a var wc_country_select_params which might be the one setting those fields, i'm searching how to edit that if it's possible - Riccardo

1 Answers

1
votes

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.