countries->get_states( $country_code ); if ( ( 'billing_state' === $key || 'shipping_state' === $key ) && ( ! is_array( $states ) || empty( $states ) ) ) { return $args; } $args['class'][] = 'sellkit-checkout-field-select'; return $args; } /** * Customized html per field. * * @param string $field field html string. * @param array $args checkout fields options. * @param string $key key of field. * @return void * @since 1.1.0 */ public function field( $field, $args, $key ) { echo ''; $default_value = ''; if ( array_key_exists( 'default', $args ) ) { $default_value = $args['default']; } if ( 'shipping_country' === $key || 'billing_country' === $key ) { $this->woocommerce_field_country( $key, $default_value ); return; } if ( 'shipping_state' === $key || 'billing_state' === $key ) { $country_code = filter_input( INPUT_COOKIE, 'sellkit-checkout-shipping-cc' ); if ( 'billing_state' === $key ) { $country_code = filter_input( INPUT_COOKIE, 'sellkit-checkout-billing-cc' ); } if ( empty( $country_code ) ) { $country_code = 'US'; } $states = WC()->countries->get_states( $country_code ); $this->woocommerce_field_state( $key, $args, $states, $default_value ); return; } $placeholder = $this->placeholder_required_value( $args ); ?>
countries->get_shipping_countries(); if ( 'billing_country' === $key ) { $countries = WC()->countries->get_allowed_countries(); } $field = ''; $field .= ''; $allowed_html = [ 'select' => [ 'name' => true, 'id' => true, 'class' => true, ], 'option' => [ 'value' => true, 'selected' => true, ], 'noscript' => [], 'input' => [ 'type' => true, 'name' => true, 'value' => true, ], ]; echo wp_kses( $field, $allowed_html ); ?>
placeholder_required_value( $args ); ?>', esc_attr( $placeholder ), esc_attr__( 'State', 'sellkit' ), esc_attr( 'sellkit-' . $key ), esc_attr( $state ) ); return; } $field = ''; $allowed_html = [ 'select' => [ 'id' => true, 'name' => true, 'placeholder' => true, ], 'option' => [ 'value' => true, 'selected' => true, ], ]; echo wp_kses( $field, $allowed_html ); ?>