How can I add comments to the delivery methods To WooCommerce admin shipping section in each shipping method?
I use WoodMart theme and this is only for administrative use (only visible in the admin panel, no need to display it on the site).
I tried this, but it didn't work
add_filter( 'woocommerce_shipping_instance_form_fields', 'add_shipping_comments', 10, 2 );
function add_shipping_comments( $fields, $instance ) {
if ( current_user_can( 'manage_options' ) ) {
$fields['shipping_comment'] = array(
'title' => __( 'Shipping Comment', 'woocommerce' ),
'type' => 'textarea',
'description' => __( 'Enter any additional comments for this shipping method.', 'woocommerce' ),
'default' => "",
);
}
return $fields;
}
Use the following, to add a custom field in WooCommerce admin shipping, to each shipping methods setting fields:
Code goes in functions.php file of your child theme (or in a plugin). Tested and works.