Add woocommerce VAT number checkout page.

$type ) {
If ($type = = \
$fields[‘vat’] = get_user_meta( $customer_id, ‘billing_vat’, true );
}
Return the $field;
}
\/\/(2) Checkout order received
add_filter( ‘woocommerce_order_formatted_billing_address’, ‘njengah_add_vat_formatted_billing_address’, 10, 2 );
Function njengah_add_vat_formatted_billing _address ($fields, $order){
$fields[‘vat’] = $order->billing_vat;
Return the $field;
}
\/\/Create a merged VAT variable for the print format
add_filter( ‘woocommerce_formatted_address_replacements’, ‘njengah_formatted_address_replacements’, 10, 2 );
Function njengah_formatted_address_replacements ($address, $args){
$address[‘{vat}’] = ”;
$address[‘{vat_upper}’]= ”;
if(!bin($args[‘vat’]){
$address[‘{vat}’] = $args[‘vat’];
$address[‘{vat_upper}’] = strtoupper($args[‘vat’]);
}
Return $address;
}
Define the Spanish format to print the address, including \/ \/ vat.
add_filter( ‘woocommerce_localisation_address_formats’, ‘njengah_localisation_address_format’ );
Function njengah_localization_address_format ($formats){
$formats [‘es’] = \
Returns the $format.
}
\/**********************************Administrator configuration page******************************************************************************************************\/
\/********************
Filter for adding VAT customer meta field (user configuration field in invoice receiving address group)
*****************\/
add_filter( ‘woocommerce_customer_meta_fields’, ‘njengah_customer_meta_fields’ );
Function njengah_customer_meta_fields ($fields){
$fields [\
\
);
Return the $field;
}
\/**********************************Administrator order page****************************************************************************************************\/
\/************
Filter – management page to add VAT to form editing when ordering
*********\/
add_filter( ‘woocommerce_admin_billing_fields’, ‘njengah_admin_
billing_fields’ );
Function njengah_admin_billing _fields ($fields){
$fields [\
\
\
);
Return the $field;
}
\/****************
Use the filter to copy the VAT field of the user meta field to the order management form (after clicking the special button on the management page).
******************\/
add_filter( ‘woocommerce_found_customer_details’, ‘njengah_found_customer_details’ );
Function njengah_fold_customer_details ($customer_data){
$customer_data[‘billing_vat’] = get_user_meta( $_POST[‘user_id’], ‘billing_vat’, true );
$customer_data return;
}The results of the front end are as follows: The following are the results of managers. Male conclusion to sum up, I learned how to add the settlement field of VAT number on the woocomerce settlement page. Functions in the subtopics to ensure that changes are not lost during updates. It is recommended that you add code snippets to your PHP file. The code snippet automatically displays the VAT number on the invoice.
The method of hiding the similar article shopping basket Update button woocommerce shopping basket page woocommerce hiding the inventory quantity method of moving the basic menu store front desk woocommerce method woocommerce hiding the Title Method to simplify the method of checking out the free item store theme woocommerce checkout label woocomm Method of creating check box fields on e-commerce settlement page woocommerce method of creating conditional settlement fields method of adding selection fields in checkout woocommerce method of changing woocommerce checkout error message woocommerce checkout method of adding base country method of refreshing settlement page woocommerce required woocommerce checkout field How to edit woocommerce payment page, how to add hidden fields, and how to set woocommerce invoice payment page, you must log in to settle. Checkout woocomerce method of creating an account send mpesa woocomerce method of payment for free woocomerce method of enforcing safe checkout

Author:

Leave a Reply

Your email address will not be published. Required fields are marked *