// (1)주문화면의 청구주소에 추가 입력 필드 표시 add_filter( 'woocommerce_checkout_fields' , 'my_custom_override_checkout_fields' ); function my_custom_override_checkout_fields( $fields ) { $fields['billing']['billing_custom_number'] = array( 'label' => '개인통관고유번호', 'placeholder' => '개인통관고유번호를 입력 해 주세요', 'required' => true, 'class' => array('form-row-wide'), 'clear' => true ); return $fields; } // (2)관리자 화면의 주문 내용에 표시 add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_number_display_admin_order_meta', 10, 1 ); function my_custom_number_display_admin_order_meta($order){ echo '<p>개인통관고유번호 : ' . get_post_meta( $order->id, '_billing_custom_number', true ) . '</p>'; } // (3)주문완료시 고객의 주문서 에 표시 add_action('woocommerce_order_details_after_customer_details', 'my_custom_number_display_order_details', 20, 1); function my_custom_number_display_order_details($order) { echo '<p><strong>개인통관고유번호 : </strong>' . get_post_meta( $order->id, '_billing_custom_number', true ) . '</p>'; } // (4)주문완료시 전송되는 이메일에 표시 add_action( 'woocommerce_email_customer_details', 'my_custom_number_display_emails', 11, 3 ); function my_custom_number_display_emails($order) { echo '<ul><li><strong>개인통관고유번호 : </strong>' . get_post_meta( $order->id, '_billing_custom_number', true ) . '</li></ul>'; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter