collect company info even when not required
This topic contains 4 replies, has 2 voices, and was last updated by Kiran 6 years, 11 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
January 3, 2018 at 11:57 pm #1072
Hi,
I would need the earlier discussed feature what has been put as task for the developers.
The original info was at the end of this topic: https://wpinvoicing.com/support/topic/replacing-first-namelast-name-fields-to-company-name/So, i would need to hide the VAT number validation completely, no button, no script, no message, but having the Company Name and VAT number field displayed and used on the invoices and records.
I dont see any development on this feature yet, but i would need this functionality to be able to open my site.
Thanks,
January 4, 2018 at 7:10 am #1077Hello,
We are implementing new features based on priority, we have some useful tasks which have higher priority then this feature.
BTW you can use following code snippet to display & save company info even after disabled.
function _wpi_custom_checkout_company_info_display_fields( $billing_details ) { global $wpinv_euvat; if ( ! empty( $wpinv_euvat ) && ! $wpinv_euvat->allow_vat_rules() ) { $tax_label = __( $wpinv_euvat->get_vat_name(), 'invoicing' ); $company_mandatory = false; // Company name mandatory? $vat_number_mandatory = false; // Vat number mandatory? ?> <p class="wpi-cart-field wpi-col2 wpi-colf"> <label for="wpinv_company" class="wpi-label"><?php _e( 'Company Name', 'invoicing' );?><?php if ( $company_mandatory ) { echo '<span class="wpi-required">*</span>'; } ?></label> <?php echo wpinv_html_text( array( 'id' => 'wpinv_company_custom', 'name' => 'wpinv_company_custom', 'value' => $billing_details['company'], 'class' => 'wpi-input form-control', 'placeholder' => __( 'Company name', 'invoicing' ), 'required' => $company_mandatory, ) ); ?> </p> <p class="wpi-cart-field wpi-col2 wpi-coll"> <label for="wpinv_vat_number_custom" class="wpi-label"><?php echo wp_sprintf( __( '%s number', 'invoicing' ), $tax_label ); ?><?php if ( $vat_number_mandatory ) { echo '<span class="wpi-required">*</span>'; } ?></label> <?php echo wpinv_html_text( array( 'id' => 'wpinv_vat_number_custom', 'name' => 'wpinv_vat_number_custom', 'value' => $billing_details['vat_number'], 'class' => 'wpi-input form-control', 'placeholder' => wp_sprintf( __( '%s number', 'invoicing' ), $tax_label ), 'required' => $vat_number_mandatory, ) ); ?> </p> <?php } } add_action( 'wpinv_checkout_billing_fields_first', '_wpi_custom_checkout_company_info_display_fields', 10, 1 ); // Display at top //add_action( 'wpinv_checkout_billing_fields_last', '_wpi_custom_checkout_company_info_display_fields', 10, 1 ); // Display at bottom function _wpi_custom_checkout_company_info_set_fields() { global $wpinv_euvat; if ( isset( $_POST['wpinv_company_custom'] ) && isset( $_POST['wpinv_vat_number_custom'] ) && ! empty( $wpinv_euvat ) && ! $wpinv_euvat->allow_vat_rules() ) { $_POST['wpinv_company'] = $_POST['wpinv_company_custom']; $_POST['wpinv_vat_number'] = $_POST['wpinv_vat_number_custom']; } } add_action( 'wpinv_pre_process_checkout', '_wpi_custom_checkout_company_info_set_fields', 10 ); function _wpi_custom_checkout_company_info_save_fields( $post, $user_info, $valid_data ) { global $wpinv_euvat, $wpi_cart; if ( isset( $post['wpinv_company_custom'] ) && isset( $post['wpinv_vat_number_custom'] ) && ! empty( $wpinv_euvat ) && ! empty( $wpi_cart ) && ! $wpinv_euvat->allow_vat_rules() ) { $wpi_cart->set( 'company', $post['wpinv_company_custom'] ); $wpi_cart->set( 'vat_number', $post['wpinv_vat_number_custom'] ); $wpi_cart->save(); } } add_action( 'wpinv_checkout_before_gateway', '_wpi_custom_checkout_company_info_save_fields', 10, 3 );
Let us know.
Thanks,
KiranJanuary 4, 2018 at 6:50 pm #1080Thank you Kiran, will check soon and will give you a feedback how it goes.
Thanks,January 5, 2018 at 9:33 pm #1081Hi Kiran,
As a confirmation, I would like to let you know your code works well. With the code I was able to get the functionality I was looking for with a small tweak to fine tune to my needs.
Thank you again, and I guess with this code anybody can achieve the same result so maybe not so important to implement this feature in your code anymore, but i give it to your consideration.
Thanks again,
January 8, 2018 at 8:05 am #1084Thanks for letting us know 🙂
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket