我如何在每种送货方式中向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;
}
字符串
1条答案
按热度按时间nhn9ugyo1#
使用以下方法,在WooCommerce管理航运中添加自定义字段,每个航运方法设置字段:
字符串
代码放在你的子主题的functions.php文件中(或插件中)。测试和工作。
的数据