add_filter('woocommerce_checkout_fields', 'add_nif_to_checkout_fields');
function add_nif_to_checkout_fields($fields) {
$fields['billing']['billing_nif'] = array(
'type' => 'text',
'label' => __('NIF', 'woocommerce'),
'placeholder' => __('Enter your NIF', 'woocommerce'),
'required' => true,
'class' => array('form-row-wide'),
'priority' => 50, // Adjust the display order
);
return $fields;
}
add_action( 'woocommerce_checkout_update_order_meta', 'save_nif_field_data' );
function save_nif_field_data( $order_id ) {
if ( isset( $_POST['billing_nif'] ) ) {
update_post_meta( $order_id, '_billing_nif', sanitize_text_field( $_POST['billing_nif'] ) );
}
}
And the “NIF” field doesn’t appear in the billing form, I don’t know if there’s something wrong with the code or that is something blocking me from editing the checkout.
]]>I wonder if there′s a best practice to add a custom field to a form, to capture the user′s ID , and display it on the Entries. Thank you!
]]>Is this possible?
Thanks!
]]>The Google Listings & Ads plugin does not recognize MetaBox custom fields assigned to products by default.
Is there any function/filter I should use?
Thanks in advance,
Francesco
I have created my own field (named: availability) for one of the apartment rental options (field options are: free, reserved, rented).
In the Pods options, the own field has been created as:
Field relation – Relation,
Relation type – Simple (own defined list)
Custom Defined Options – free|FREE, reserved|RESERVED, rented|RENTED.
My question: how can I add a dependency so that the front-end apartment rental status font color is displayed as:
free – green font, reserved – yellow font, rented – red font ?
Can I set this type of dependency in the Pods plugin, or somehow put it in the functions.php file, how to do it?
I will be very grateful for your help!
]]>Is there any way to display the custom fields directly in the list view?
With the default settings, I can only choose to have them hover when clicked in tooltip.
I would like to be able to see the information of the custom fields directly in the list view.
]]>We use Jetpack crm for creating invoices.
And we want to add more fields to the invoice template.
Could you please clarify on how to output data from a created custom field to an invoice template?
Thanks
]]>