אפשר לשנות לאיזה שדה שתרצו
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function – $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
$fields['shipping']['the_floor'] = array(
'label' => __('קומה', 'woocommerce'),
'placeholder' => _x('קומה', 'placeholder', 'woocommerce'),
'required' => true,
'class' => array('form-row-wide'),
'clear' => true,
'priority' => 61
);
$fields['billing']['the_floor'] = array(
'label' => __('קומה', 'woocommerce'),
'placeholder' => _x('קומה', 'placeholder', 'woocommerce'),
'required' => true,
'class' => array('form-row-wide'),
'clear' => true,
'priority' => 61
);
return $fields;
}
/**
* Display field value on the order edit page
*/
add_action( 'woocommerce_admin_order_data_after_shipping_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );
function my_custom_checkout_field_display_admin_order_meta($order){
echo '<p><strong>'.__('קומה').':</strong> ' . get_post_meta( $order->get_id(), '_the_floor', true ) . '</p>';
}
Code language: PHP (php)