nevillecampher
Forum Replies Created
-
all sorted now
on the preview it shows correctly but when you print invoive ot goes weird
The other courier companies works 100%. It is only on “The Courier Guy ” South Africa which returns the errors above
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Customer Vat NumberGood Day dwpriv
Have not use the code you gave above in your post. I have a snipped that has the the code below that adds to my order in the billing details admin frontend the Vat field and the mobile field. Here is the code. It also adds in in the front end when a order is placed and the clients checks out a order on the billing details
/***************************** FRONTEND ****************************************/ /************************** Filter to add a Vat field to: - My Account - Edit Form -- Billing fields - Checkout - Edit Form - Billing Fields This function is also reordering the form fields Source: https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters ***************************/ function add_woocommerce_billing_fields($billing_fields){ //reorder woo my billing address form fields $billing_fields2['billing_first_name'] = $billing_fields['billing_first_name']; $billing_fields2['billing_last_name'] = $billing_fields['billing_last_name']; $billing_fields2['billing_company'] = $billing_fields['billing_company']; $billing_fields2['billing_vat'] = $billing_fields['billing_vat']; $billing_fields2['billing_address_1'] = $billing_fields['billing_address_1']; $billing_fields2['billing_address_2'] = $billing_fields['billing_address_2']; $billing_fields2['billing_suburb'] = $billing_fields['billing_suburb']; $billing_fields2['billing_phone'] = $billing_fields['billing_phone']; $billing_fields2['billing_mobile'] = $billing_fields['billing_mobile']; $billing_fields2['billing_vat'] = array( 'type' => 'text', 'label' => __('Vat number', 'keyelp-shop-customization' ), 'class' => array('form-row-wide'), 'required' => false, 'clear' => true ); $billing_fields2['billing_mobile'] = array( 'type' => 'text', 'label' => __('Mobile number', 'keyelp-shop-customization' ), 'class' => array('form-row-wide'), 'required' => true, 'clear' => true ); //unimos el resto de campos $merged_billing_fields = $billing_fields2 + $billing_fields; return $merged_billing_fields; } add_filter('woocommerce_billing_fields' , 'display_billing_vat_fields'); function display_billing_vat_fields($billing_fields){ $billing_fields['billing_vat'] = array( 'type' => 'text', 'label' => __('Vat number', 'woocommerce' ), 'class' => array('form-row-wide'), 'required' => false, 'clear' => true, 'priority' => 35, // To change the field location increase or decrease this value ); return $billing_fields; } add_filter('woocommerce_billing_fields' , 'display_billing_mobile_fields'); function display_billing_mobile_fields($billing_fields){ $billing_fields['billing_mobile'] = array( 'type' => 'text', 'label' => __('Mobile number', 'woocommerce' ), 'class' => array('form-row-wide'), 'required' => true, 'clear' => true, 'priority' => 35, // To change the field location increase or decrease this value ); return $billing_fields; } /*************************** ADMIN ORDER PAGE ****************************************/ /********* Filter to add Vat to the Edit Form on Order -- Admin page on Order view - Neville these to stay working on order adminb opage when edit *********/ add_filter( 'woocommerce_admin_billing_fields', 'njengah_admin_billing_fields' ); function njengah_admin_billing_fields( $fields ) { $fields['vat'] = array( 'label' => __( 'Vat number', 'njengah' ), 'show' => true ); $fields['mobile'] = array( 'label' => __( 'Mobile number', 'njengah' ), 'show' => true ); return $fields; } /**************** Filter to copy the Vat field from User meta fields to the Order Admin form (after clicking the dedicated button on the admin page) ******************/ add_filter( 'woocommerce_found_customer_details', 'custom_found_customer_details' ); function custom_found_customer_details( $customer_data ) { $customer_data['billing_vat'] = get_user_meta( $_POST['user_id'], 'billing_vat', true ); $customer_data['billing_mobile'] = get_user_meta( $_POST['user_id'], 'billing_mobile', true ); return $customer_data; }
On my Child theme i have created the Custom PDF Invoices and in the invoice.php file in my child theme i have the code below. But is shows blank and does not show the Vat, but it does. The code you gave is not in my invoice.php file and even if I add it it does not show
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> <?php do_action( 'wpo_wcpdf_before_document', $this->get_type(), $this->order ); ?> <table class="head container"> <tr> <td class="header"> <?php if ( $this->has_header_logo() ) { do_action( 'wpo_wcpdf_before_shop_logo', $this->get_type(), $this->order ); $this->header_logo(); do_action( 'wpo_wcpdf_after_shop_logo', $this->get_type(), $this->order ); } else { $this->title(); } ?> </td> <td class="shop-info"> <?php do_action( 'wpo_wcpdf_before_shop_name', $this->get_type(), $this->order ); ?> <div class="shop-name"><h3><?php $this->shop_name(); ?></h3></div> <?php do_action( 'wpo_wcpdf_after_shop_name', $this->get_type(), $this->order ); ?> <?php do_action( 'wpo_wcpdf_before_shop_address', $this->get_type(), $this->order ); ?> <div class="shop-address"><?php $this->shop_address(); ?></div> <?php do_action( 'wpo_wcpdf_after_shop_address', $this->get_type(), $this->order ); ?> </td> </tr> </table> <?php do_action( 'wpo_wcpdf_before_document_label', $this->get_type(), $this->order ); ?> <h1 class="document-type-label"> <?php if ( $this->has_header_logo() ) $this->title(); ?> </h1> <?php do_action( 'wpo_wcpdf_after_document_label', $this->get_type(), $this->order ); ?> <table class="order-data-addresses"> <tr> <td class="address billing-address"> <!-- <h3><?php _e( 'Billing Address:', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3> --> <?php do_action( 'wpo_wcpdf_before_billing_address', $this->get_type(), $this->order ); ?> <?php $this->billing_address(); ?> <?php do_action( 'wpo_wcpdf_after_billing_address', $this->get_type(), $this->order ); ?> <?php if ( isset( $this->settings['display_email'] ) ) : ?> <div class="billing-email"><Strong>e: </Strong><?php $this->billing_email(); ?></div> <?php endif; ?> <?php if ( isset( $this->settings['display_phone'] ) ) : ?> <div class="billing-phone"><Strong>p: </Strong><?php $this->billing_phone(); ?></div> <?php endif; ?> <br> <?php if ( isset( $this->settings['display_billing_vat'] ) ) : ?> <div class="billing_vat"><Strong>V: </Strong><?php $this->billing_vat(); ?></div> <?php endif; ?> <br> <?php if ( isset( $this->settings['display_billing_mobile'] ) ) : ?> <div class="billing_mobile"><Strong>M: </Strong><?php $this->billing_mobile(); ?><div> <?php endif; ?> </td> <td class="address shipping-address"> <?php if ( $this->show_shipping_address() ) : ?> <h3><?php _e( 'Ship To:', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3> <?php do_action( 'wpo_wcpdf_before_shipping_address', $this->get_type(), $this->order ); ?> <?php $this->shipping_address(); ?> <?php do_action( 'wpo_wcpdf_after_shipping_address', $this->get_type(), $this->order ); ?> <?php if ( isset( $this->settings['display_phone'] ) ) : ?> <div class="shipping-phone"><?php $this->shipping_phone(); ?></div> <?php endif; ?> <?php endif; ?> </td> <td class="order-data"> <table> <?php do_action( 'wpo_wcpdf_before_order_data', $this->get_type(), $this->order ); ?> <?php if ( isset( $this->settings['display_number'] ) ) : ?> <tr class="invoice-number"> <th><?php echo $this->get_number_title(); ?></th> <td><?php $this->invoice_number(); ?></td> </tr> <?php endif; ?> <?php if ( isset( $this->settings['display_date'] ) ) : ?> <tr class="invoice-date"> <th><?php echo $this->get_date_title(); ?></th> <td><?php $this->invoice_date(); ?></td> </tr> <?php endif; ?> <tr class="order-number"> <th><?php _e( 'Order Number:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th> <td><?php $this->order_number(); ?></td> </tr> <tr class="order-date"> <th><?php _e( 'Order Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th> <td><?php $this->order_date(); ?></td> </tr> <?php if ( $payment_method = $this->get_payment_method() ) : ?> <tr class="payment-method"> <th><?php _e( 'Payment Method:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th> <td><?php echo $payment_method; ?></td> </tr> <?php endif; ?> <?php do_action( 'wpo_wcpdf_after_order_data', $this->get_type(), $this->order ); ?> </table> </td> </tr> </table> <?php do_action( 'wpo_wcpdf_before_order_details', $this->get_type(), $this->order ); ?> <table class="order-details"> <thead> <tr> <th class="product"><?php _e( 'Product', 'woocommerce-pdf-invoices-packing-slips' ); ?></th> <th class="quantity"><?php _e( 'Quantity', 'woocommerce-pdf-invoices-packing-slips' ); ?></th> <th class="price"><?php _e( 'Price', 'woocommerce-pdf-invoices-packing-slips' ); ?></th> </tr> </thead> <tbody> <?php foreach ( $this->get_order_items() as $item_id => $item ) : ?> <tr class="<?php echo apply_filters( 'wpo_wcpdf_item_row_class', 'item-'.$item_id, esc_attr( $this->get_type() ), $this->order, $item_id ); ?>"> <td class="product"> <?php $description_label = __( 'Description', 'woocommerce-pdf-invoices-packing-slips' ); // registering alternate label translation ?> <span class="item-name"><?php echo $item['name']; ?></span> <?php do_action( 'wpo_wcpdf_before_item_meta', $this->get_type(), $item, $this->order ); ?> <span class="item-meta"><?php echo $item['meta']; ?></span> <dl class="meta"> <?php $description_label = __( 'SKU', 'woocommerce-pdf-invoices-packing-slips' ); // registering alternate label translation ?> <?php if ( ! empty( $item['sku'] ) ) : ?><dt class="sku"><?php _e( 'SKU:', 'woocommerce-pdf-invoices-packing-slips' ); ?></dt><dd class="sku"><?php echo esc_attr( $item['sku'] ); ?></dd><?php endif; ?> <?php if ( ! empty( $item['weight'] ) ) : ?><dt class="weight"><?php _e( 'Weight:', 'woocommerce-pdf-invoices-packing-slips' ); ?></dt><dd class="weight"><?php echo esc_attr( $item['weight'] ); ?><?php echo esc_attr( get_option( 'woocommerce_weight_unit' ) ); ?></dd><?php endif; ?> </dl> <?php do_action( 'wpo_wcpdf_after_item_meta', $this->get_type(), $item, $this->order ); ?> </td> <td class="quantity"><?php echo $item['quantity']; ?></td> <td class="price"><?php echo $item['order_price']; ?></td> </tr> <?php endforeach; ?> </tbody> <tfoot> <tr class="no-borders"> <td class="no-borders"> <div class="document-notes"> <?php do_action( 'wpo_wcpdf_before_document_notes', $this->get_type(), $this->order ); ?> <?php if ( $this->get_document_notes() ) : ?> <h3><?php _e( 'Notes', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3> <?php $this->document_notes(); ?> <?php endif; ?> <?php do_action( 'wpo_wcpdf_after_document_notes', $this->get_type(), $this->order ); ?> </div> <div class="customer-notes"> <?php do_action( 'wpo_wcpdf_before_customer_notes', $this->get_type(), $this->order ); ?> <?php if ( $this->get_shipping_notes() ) : ?> <h3><?php _e( 'Customer Notes', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3> <?php $this->shipping_notes(); ?> <?php endif; ?> <?php do_action( 'wpo_wcpdf_after_customer_notes', $this->get_type(), $this->order ); ?> </div> </td> <td class="no-borders" colspan="2"> <table class="totals"> <tfoot> <?php foreach ( $this->get_woocommerce_totals() as $key => $total ) : ?> <tr class="<?php echo esc_attr( $key ); ?>"> <th class="description"><?php echo $total['label']; ?></th> <td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td> </tr> <?php endforeach; ?> </tfoot> </table> </td> </tr> </tfoot> </table> <div class="bottom-spacer"></div> <?php do_action( 'wpo_wcpdf_after_order_details', $this->get_type(), $this->order ); ?> <?php if ( $this->get_footer() ) : ?> <div id="footer"> <!-- hook available: wpo_wcpdf_before_footer --> <?php $this->footer(); ?> <!-- hook available: wpo_wcpdf_after_footer --> </div><!-- #letter-footer --> <?php endif; ?> <?php do_action( 'wpo_wcpdf_after_document', $this->get_type(), $this->order ); ?>
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Customer Vat Number/***************************** FRONTEND ****************************************/ /************************** Filter to add a Vat field to: - My Account - Edit Form -- Billing fields - Checkout - Edit Form - Billing Fields This function is also reordering the form fields Source: https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters ***************************/ function add_woocommerce_billing_fields($billing_fields){ //reorder woo my billing address form fields $billing_fields2['billing_first_name'] = $billing_fields['billing_first_name']; $billing_fields2['billing_last_name'] = $billing_fields['billing_last_name']; $billing_fields2['billing_company'] = $billing_fields['billing_company']; $billing_fields2['billing_vat'] = $billing_fields['billing_vat']; $billing_fields2['billing_address_1'] = $billing_fields['billing_address_1']; $billing_fields2['billing_address_2'] = $billing_fields['billing_address_2']; $billing_fields2['billing_suburb'] = $billing_fields['billing_suburb']; $billing_fields2['billing_phone'] = $billing_fields['billing_phone']; $billing_fields2['billing_mobile'] = $billing_fields['billing_mobile']; $billing_fields2['billing_vat'] = array( 'type' => 'text', 'label' => __('Vat number', 'keyelp-shop-customization' ), 'class' => array('form-row-wide'), 'required' => false, 'clear' => true ); $billing_fields2['billing_mobile'] = array( 'type' => 'text', 'label' => __('Mobile number', 'keyelp-shop-customization' ), 'class' => array('form-row-wide'), 'required' => true, 'clear' => true ); //unimos el resto de campos $merged_billing_fields = $billing_fields2 + $billing_fields; return $merged_billing_fields; } add_filter('woocommerce_billing_fields' , 'display_billing_vat_fields'); function display_billing_vat_fields($billing_fields){ $billing_fields['billing_vat'] = array( 'type' => 'text', 'label' => __('Vat number', 'woocommerce' ), 'class' => array('form-row-wide'), 'required' => false, 'clear' => true, 'priority' => 35, // To change the field location increase or decrease this value ); return $billing_fields; } add_filter('woocommerce_billing_fields' , 'display_billing_mobile_fields'); function display_billing_mobile_fields($billing_fields){ $billing_fields['billing_mobile'] = array( 'type' => 'text', 'label' => __('Mobile number', 'woocommerce' ), 'class' => array('form-row-wide'), 'required' => true, 'clear' => true, 'priority' => 35, // To change the field location increase or decrease this value ); return $billing_fields; } /*************************** ADMIN ORDER PAGE ****************************************/ /********* Filter to add Vat to the Edit Form on Order -- Admin page on Order view - Neville these to stay working on order adminb opage when edit *********/ add_filter( 'woocommerce_admin_billing_fields', 'njengah_admin_billing_fields' ); function njengah_admin_billing_fields( $fields ) { $fields['vat'] = array( 'label' => __( 'Vat number', 'njengah' ), 'show' => true ); $fields['mobile'] = array( 'label' => __( 'Mobile number', 'njengah' ), 'show' => true ); return $fields; } /**************** Filter to copy the Vat field from User meta fields to the Order Admin form (after clicking the dedicated button on the admin page) ******************/ add_filter( 'woocommerce_found_customer_details', 'custom_found_customer_details' ); function custom_found_customer_details( $customer_data ) { $customer_data['billing_vat'] = get_user_meta( $_POST['user_id'], 'billing_vat', true ); $customer_data['billing_mobile'] = get_user_meta( $_POST['user_id'], 'billing_mobile', true ); return $customer_data; }
Above is the code I used to add a custom field into my Woocommerce for a Customer VAT field and Client Mobile Number.
So I need to get the info (vat and Mobile number on the PDF that is done via this code and saved in my clients order that I can insert to pull from the custom PDF file Invoice.php
- This reply was modified 1 year, 3 months ago by nevillecampher.
- This reply was modified 1 year, 3 months ago by nevillecampher.
I need some help, I have create the template in my child theme and I wish to add the following fields to my invoice .
My custom fields on My Billing section is
“billing_mobile”
“billing_vat”
Hi
Thank you for adding the previous courier . Can you also please add the following courier
DPD Laser
https://www.dpd.com/za/en/receiving-parcels/track-my-parcel/
Forum: Reviews
In reply to: [Facebook for WooCommerce] Poor development causing crashes on WooCommerceSame Issue, after update woo-commerce setting no longer loads, need to get previous version. has anybody got the previous plugin version
Forum: Plugins
In reply to: [Advanced Shipment Tracking for WooCommerce] Request to amend courier companyHi
Here is image and courier marked in circle
https://drive.google.com/file/d/1hPzFf6_eOx9fjGK_dP3nZDeMAJuZZ3Az/view?usp=sharing
Forum: Plugins
In reply to: [Advanced Shipment Tracking for WooCommerce] Request to amend courier companyIt is currently on my screen showing
First Freight
South AfricaHow do I ad a screenshot or where can I mail it to
Forum: Plugins
In reply to: [Advanced Shipment Tracking for WooCommerce] Request to amend courier companyCan you also add as well on “The Courier Guy South Africa their logo as well https://www.thecourierguy.co.za/
Forum: Plugins
In reply to: [Advanced Shipment Tracking for WooCommerce] Request to amend courier companyCourier Company is First Freight in South Africa
Forum: Plugins
In reply to: [WC Fields Factory] Admin Fields Showing clients side incorrectHi
Thank you that worked
Forum: Plugins
In reply to: [WC Fields Factory] Version 4.0.1Hi
I reverted back to the previous version as it still did not show o the updatdd plugins and log file shows no errors. Even if I create new custom text fields i product inventory or general fields it still does not work
Forum: Plugins
In reply to: [Cities Shipping Zones for WooCommerce] Customer’s CityDisabled the compulsory fields and then order is requested, but when I then go to my admin site in woocommerce in orders there are no city loaded in the city filed and province / state area