하지만 당신은 사용할 수 있습니다 :
: 내 의견
add_action('woocommerce_product_options_general_product_data', 'my_custom_fields');
function my_custom_fields() {
$field = array(
//This ID will be use on the _postmeta table as key_name
'id' => 'my_custom_message',
//Text that goes inside the label tag
'label' => 'Message:',
//This text will appear on the description column
'description' => 'This is a custom message not part of WooCommerce',
//Boolean that determines the display of the description
'desc_tip' => true,
//Standard html input placeholder
'placeholder' => 'Type a message',
);
woocommerce_wp_text_input($field);
}
add_action('woocommerce_process_product_meta', 'save_my_custom_fields');
function save_my_custom_fields($post_id) {
update_post_meta(
$post_id,
'my_custom_message',
esc_attr($POST['my_custom_message'])
);
}
$ 필드 배열이 최소한 있어야합니다
$field = array(
'id' => 'my_custom_message',//This ID will be use on the _postmeta table as key_name
'label' => 'Message:',//Text that goes inside the label tag
'description' => 'This is a custom message not part of WooCommerce',//This text will appear on the description column
'desc_tip' => true,//Boolean that determines the display of the description
'placeholder' => 'Type a message',//Standard html input placeholder
);
또한 다음을 지정할 수 있습니다
'class' => 'css-class',//Class attributte for the input tag
'style' => 'background:red',//Style attribute for the input tag
'wrapper_class' => 'css-class',//Class for the wrapper of the input tag, it is a paragraph
하면 데이터가 콧수염이 Underscore.js 템플릿을 영감을 사용하여 채워 동안 HTML의 믹스'th'와'tfoot'에 볼 수있는 테이블. 자세한 내용은'\ includes \ admin \ settings \ views \ html-admin-page-shipping-zone-methods.php'를보십시오. –
배송 방법 설정의 모델은 또한 Underscore.js 템플릿을 기반으로합니다. 따라서 뷰를 수정하고 입력 된 데이터를 처리하려면 사용자 정의 JS를 사용해야합니다. 데이터 부분을 저장/검색하려면 코어 설정 API를 사용하여 옵션을 저장하면됩니다. 프론트 엔드에서 같은 것을 표시하려면 각 WC 템플리트에서 후크를 사용해야합니다. –