Last active
June 29, 2018 11:19
-
-
Save sibaberpollo/e1b713a55e2d63a5bdf7a2a092b3de19 to your computer and use it in GitHub Desktop.
En el function.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( "woocommerce_checkout_fields", "reordering_checkout_fields", 15, 1 ); | |
function reordering_checkout_fields( $fields ) { | |
## ---- 1. REORDERING BILLING FIELDS ---- ## | |
// Set the order of the fields | |
$billing_order = array( | |
'billing_rut', | |
'billing_first_name', | |
'billing_last_name', | |
'billing_email', | |
'billing_phone', | |
'billing_company', | |
'billing_country', | |
'billing_address_1', | |
'billing_address_2', | |
'billing_postcode', | |
'billing_state', | |
'billing_city' | |
); | |
$count = 0; | |
$priority = 10; | |
// Updating the 'priority' argument | |
foreach($billing_order as $field_name){ | |
$count++; | |
$fields['billing'][$field_name]['priority'] = $count * $priority; | |
} | |
## ---- 2. CHANGING SOME CLASSES FOR BILLING FIELDS ---- ## | |
$fields['billing']['billing_rut']['class'] = array('form-row-wide'); | |
$fields['billing']['billing_email']['class'] = array('form-row-first'); | |
$fields['billing']['billing_phone']['class'] = array('form-row-last'); | |
$fields['billing']['billing_state']['class'] = array('form-row-first'); | |
$fields['billing']['billing_city']['class'] = array('form-row-last'); | |
## ---- RETURN THE BILLING FIELDS CUSTOMIZED ---- ## | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Y en en tmp-somela/woocommerce/checkout/form-billing.php
<script> $ = jQuery; $( window ).load(function() { $("#billing_address_1_field").insertAfter("#billing_postcode_field"); $("#billing_address_2_field").insertAfter("#billing_address_1_field"); }); </script>