Support » Plugin: WooCommerce Checkout Manager » __() is called with an array() as the first parameter

  • Hi,

    My name is David from the WPML Compatibility team. I’m writing about an issue reported in our support forum:

    The problem is that “WooCommerce Checkout Manager” is calling the __() function to translate a string with an array() instead of a string in includes/classes/field_filters.php line 479

    __( $cvalue, 'woocommerce-checkout-manager' )

    This happens only with state fields because according to comments in the source code, when a country has no estates we keep an empty array:

    // States set to array() are blank i.e. the country has no use for the state field.

    The solution could be to check its a string, changing the loop to:

            foreach( $states as $ckey => $cvalue ) {
                if ( is_string( $cvalue ) ) {
                    $field .= '<option value="' . esc_attr( $ckey ) . '" '.selected( $value, $ckey, false ) .'>'.__( $cvalue, 'woocommerce-checkout-manager' ) .'</option>';

    Please let me know if you can consider including that fix in a future release.

  • The topic ‘__() is called with an array() as the first parameter’ is closed to new replies.