Home › Forums › WoodMart support forum › Bug in the WoodMart Checkout Fields editor with the “country” dropdown field
Bug in the WoodMart Checkout Fields editor with the “country” dropdown field
- This topic has 13 replies, 2 voices, and was last updated 5 months, 1 week ago by Artem Temos.
-
AuthorPosts
-
July 6, 2024 at 7:34 pm #581555
Jeriss Cloud CenterParticipantAs soon as I change the country, the row gets a weird / broken style.
If I put back default store country from the WooCommerce settings (here, Belgium), the style reverts to the correct behavior on page refresh. Else, it remains broken.
Check video attached.
- This topic was modified 5 months, 2 weeks ago by Jeriss Cloud Center.
Attachments:
You must be logged in to view attached files.July 8, 2024 at 9:06 am #581643
Artem TemosKeymasterHello,
Please, provide us with your admin access so we can log in and check this on your side.
Thank you in advance.
July 8, 2024 at 11:49 am #581713
Jeriss Cloud CenterParticipantAccess below.
1) All plugins are disabled
2) All customizations are removed.
3) Parent theme is enabled.July 9, 2024 at 10:59 am #582009
Artem TemosKeymaster1. Try to edit the file
wp-content\themes\woodmart\inc\integrations\woocommerce\modules\checkout-fields\class-frontend.php
and find the following methodupdate_checkout_fields
(https://monosnap.com/file/hrrXZuVGBi2CcjmQ03hOZl8XtVTy9T)2. Replace it with the following code
public function update_checkout_fields( $checkout_fields ) { if ( ! woodmart_get_opt( 'checkout_fields_enabled' ) || ! is_checkout() ) { return $checkout_fields; } $change_options = get_option( 'xts_checkout_fields_manager_options', array() ); if ( empty( $change_options ) ) { return $checkout_fields; } foreach ( $change_options as $group_key => $checkout_groups_fields ) { if ( ! isset( $checkout_fields[ $group_key ] ) ) { continue; } foreach ( $checkout_groups_fields as $field_key => $checkout_field ) { if ( isset( $checkout_field['status'] ) && ! $checkout_field['status'] ) { unset( $checkout_fields[ $group_key ][ $field_key ] ); continue; } if ( ! isset( $checkout_fields[ $group_key ][ $field_key ] ) ) { $checkout_fields[ $group_key ][ $field_key ] = $checkout_field; continue; } // Remove screen reader. if ( isset( $checkout_fields[ $group_key ][ $field_key ]['label_class'] ) && is_array( $checkout_fields[ $group_key ][ $field_key ]['label_class'] ) && in_array( 'screen-reader-text', $checkout_fields[ $group_key ][ $field_key ]['label_class'], true ) ) { unset( $checkout_fields[ $group_key ][ $field_key ]['label_class'][ array_search( 'screen-reader-text', $checkout_fields[ $group_key ][ $field_key ]['label_class'], true ) ] ); } // Remove old position class before added new. $remove_classes = array(); $positions_classes = array( 'form-row-first', 'form-row-wide', 'form-row-last', ); foreach ( $positions_classes as $positions_class ) { $remove_classes[] = array_search( $positions_class, $checkout_fields[ $group_key ][ $field_key ]['class'], true ); } $remove_classes = array_filter( array_unique( $remove_classes ), function ( $el ) { return $el || 0 === $el; } ); if ( ! empty( $remove_classes ) ) { foreach ( $remove_classes as $id ) { unset( $checkout_fields[ $group_key ][ $field_key ]['class'][ $id ] ); } } $checkout_fields[ $group_key ][ $field_key ] = $this->helper->recursive_parse_args( $checkout_field, $checkout_fields[ $group_key ][ $field_key ] ); } } return $checkout_fields; }
July 9, 2024 at 12:01 pm #582052
Jeriss Cloud CenterParticipantHello,
I did as you suggested but it’s not good.
1) The problem with the Country dropdown is not solved (despite clearing cache, and even despite resetting all fields to their default in the Checkout Editor)
2) Now worse, the First Name and Last Name are showing Wide whereas I defined them as Left and Right.
Please check again
ThanksJuly 9, 2024 at 12:21 pm #582065
Artem TemosKeymasterWe see that you didn’t make any changes in the mentioned file. Please do this now and test how it works.
July 9, 2024 at 12:22 pm #582066
Jeriss Cloud CenterParticipantI did it on my live site
- This reply was modified 5 months, 2 weeks ago by Jeriss Cloud Center.
July 9, 2024 at 12:29 pm #582069
Jeriss Cloud CenterParticipantI just replaced it on the staging too, and same problem as reported above.
July 9, 2024 at 12:56 pm #582073
Artem TemosKeymasterTry to replace that code with the following one instead
public function update_checkout_fields( $checkout_fields ) { if ( ! woodmart_get_opt( 'checkout_fields_enabled' ) || ! is_checkout() ) { return $checkout_fields; } $change_options = get_option( 'xts_checkout_fields_manager_options', array() ); if ( empty( $change_options ) ) { return $checkout_fields; } foreach ( $change_options as $group_key => $checkout_groups_fields ) { if ( ! isset( $checkout_fields[ $group_key ] ) ) { continue; } foreach ( $checkout_groups_fields as $field_key => $checkout_field ) { if ( isset( $checkout_field['status'] ) && ! $checkout_field['status'] ) { unset( $checkout_fields[ $group_key ][ $field_key ] ); continue; } if ( ! isset( $checkout_fields[ $group_key ][ $field_key ] ) ) { $checkout_fields[ $group_key ][ $field_key ] = $checkout_field; continue; } // Remove screen reader. if ( isset( $checkout_fields[ $group_key ][ $field_key ]['label_class'] ) && is_array( $checkout_fields[ $group_key ][ $field_key ]['label_class'] ) && in_array( 'screen-reader-text', $checkout_fields[ $group_key ][ $field_key ]['label_class'], true ) ) { unset( $checkout_fields[ $group_key ][ $field_key ]['label_class'][ array_search( 'screen-reader-text', $checkout_fields[ $group_key ][ $field_key ]['label_class'], true ) ] ); } // Remove old position class before added new. if ( isset( $checkout_field['class'] ) ) { $remove_classes = array(); $positions_classes = array( 'form-row-first', 'form-row-wide', 'form-row-last', ); foreach ( $positions_classes as $positions_class ) { $remove_classes[] = array_search( $positions_class, $checkout_fields[ $group_key ][ $field_key ]['class'], true ); } $remove_classes = array_filter( array_unique( $remove_classes ), function ( $el ) { return $el || 0 === $el; } ); if ( ! empty( $remove_classes ) ) { foreach ( $remove_classes as $id ) { unset( $checkout_fields[ $group_key ][ $field_key ]['class'][ $id ] ); } } $checkout_fields[ $group_key ][ $field_key ] = $this->helper->recursive_parse_args( $checkout_field, $checkout_fields[ $group_key ][ $field_key ] ); } } } return $checkout_fields; }
July 9, 2024 at 2:08 pm #582103
Jeriss Cloud CenterParticipant1) The regression about the First Name and Last Name is solved
2) But the initial issue about the country is still there.
Try by yourself on the staging. I installed a File Editor where you can test your code by yourself.
Then go to checkout and try a country like Spain for instance (“Espagne”)
July 10, 2024 at 4:58 pm #582471
Artem TemosKeymasterWe have fixed this on the staging website. Please test it and let me know if it works.
You can copy the following file to your live website to test it therewp-content\themes\woodmart\inc\integrations\woocommerce\modules\checkout-fields\class-frontend.php
Kind Regards
July 10, 2024 at 5:20 pm #582476
Jeriss Cloud CenterParticipantit’s working good now thanks !
July 10, 2024 at 5:23 pm #582481
Jeriss Cloud CenterParticipantYou can close this ticket
July 11, 2024 at 9:21 am #582564
Artem TemosKeymasterYou are always welcome. Feel free to contact us if you have any further questions.
-
AuthorPosts
The topic ‘Bug in the WoodMart Checkout Fields editor with the “country” dropdown field’ is closed to new replies.
- You must be logged in to create new topics. Login / Register