Skip to content

Instantly share code, notes, and snippets.

@bolderelements
Last active December 11, 2020 21:29
Show Gist options
  • Save bolderelements/ae2dcf5fa59c6e7e6bf97f1c468c7ed3 to your computer and use it in GitHub Desktop.
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
/**
* 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