如何在每种发货方式中向WooCommerce管理发货部分的发货方法添加备注?
我使用WoodMart主题,这仅用于管理用途(仅在管理面板中可见,无需在网站上显示).
我试过了,但不起作用
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;
}