Warning: This method has been deprecated.
WC_Admin_Setup_Wizard::shipping_method_selection_form( string $country_code, string $currency_code, string $input_prefix )
Render the available shipping methods for a given country code.
Description Description
Parameters Parameters
- $country_code
-
(Required) Country code.
- $currency_code
-
(Required) Currency code.
- $input_prefix
-
(Required) Input prefix.
Source Source
File: includes/admin/class-wc-admin-setup-wizard.php
protected function shipping_method_selection_form( $country_code, $currency_code, $input_prefix ) { $selected = 'flat_rate'; $shipping_methods = $this->get_wizard_shipping_methods( $country_code, $currency_code ); ?> <div class="wc-wizard-shipping-method-select"> <div class="wc-wizard-shipping-method-dropdown"> <select id="<?php echo esc_attr( "{$input_prefix}[method]" ); ?>" name="<?php echo esc_attr( "{$input_prefix}[method]" ); ?>" class="method wc-enhanced-select" data-plugins="<?php echo wc_esc_json( wp_json_encode( $this->get_wcs_requisite_plugins() ) ); ?>" > <?php foreach ( $shipping_methods as $method_id => $method ) : ?> <option value="<?php echo esc_attr( $method_id ); ?>" <?php selected( $selected, $method_id ); ?>><?php echo esc_html( $method['name'] ); ?></option> <?php endforeach; ?> </select> </div> <div class="shipping-method-descriptions"> <?php foreach ( $shipping_methods as $method_id => $method ) : ?> <p class="shipping-method-description <?php echo esc_attr( $method_id ); ?> <?php echo $method_id !== $selected ? 'hide' : ''; ?>"> <?php echo esc_html( $method['description'] ); ?> </p> <?php endforeach; ?> </div> </div> <div class="shipping-method-settings"> <?php foreach ( $shipping_methods as $method_id => $method ) : ?> <?php if ( empty( $method['settings'] ) ) { continue; } ?> <div class="shipping-method-setting <?php echo esc_attr( $method_id ); ?> <?php echo $method_id !== $selected ? 'hide' : ''; ?>"> <?php foreach ( $method['settings'] as $setting_id => $setting ) : ?> <?php $method_setting_id = "{$input_prefix}[{$method_id}][{$setting_id}]"; ?> <input type="<?php echo esc_attr( $setting['type'] ); ?>" placeholder="<?php echo esc_attr( $setting['default_value'] ); ?>" id="<?php echo esc_attr( $method_setting_id ); ?>" name="<?php echo esc_attr( $method_setting_id ); ?>" class="<?php echo esc_attr( $setting['required'] ? 'shipping-method-required-field' : '' ); ?>" <?php echo ( $method_id === $selected && $setting['required'] ) ? 'required' : ''; ?> /> <p class="description"> <?php echo esc_html( $setting['description'] ); ?> </p> <?php endforeach; ?> </div> <?php endforeach; ?> </div> <?php }
Changelog Changelog
Version | Description |
---|---|
4.6.0 | Introduced. |