Last active
December 11, 2020 21:29
-
-
Save bolderelements/ae2dcf5fa59c6e7e6bf97f1c468c7ed3 to your computer and use it in GitHub Desktop.
Add a form field to one of the sections in Table Rate method
This file contains hidden or 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
/** | |
* Add form field to 'Additional Options' section in the Table of Rates | |
* | |
* @return string | |
*/ | |
function betrs_add_settings_field( $settings ) { | |
// array of shipping provider codes | |
$shipping_carriers = array( | |
'usps' => 'US Postal Service', | |
'fedex' => 'FedEx', | |
'ups' => 'UPS' | |
); | |
$settings['other']['settings']['shipping_carriers'] = array( | |
'title' => __( 'Carrier Selection', 'be-table-ship' ), | |
'type' => 'multiselect', | |
'class' => 'wc-enhanced-select', | |
'default' => '', | |
'options' => $shipping_carriers, | |
); | |
return $settings; | |
} | |
add_filter( 'woocommerce_shipping_instance_form_fields_betrs_shipping', 'betrs_add_settings_field', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment