Display Custom Vendor registration field in Invoice.

WCMp Core

Display Custom Vendor registration field in Invoice. Open

Viewing 31 reply threads
  • Author
    Posts
    • #78306
      sumanth
      Participant

      Consider there is a field Label “X” with some value .

      Now, Display field “X”value of vendor registration form in Invoice to Customer.

      Help me.

    • #78330

      @sumanth, In order to display any field data provided by the vendor at the time of registration in the invoice, you need to do custom code.

      If you need a reference of the coding procedure, let us know.

    • #78421
      sumanth
      Participant

      Yes i need it. Please guide me.

    • #78442

      @sumanth, when a user register via the registration form, we save their data in user meta. Now you have to fetch that data and display them in the invoice.
      You can get all the registration form data from the user_meta named “wcmp_vendor_fields”, a sample code for you, whic returns the data as an array :

      $vendor_application_data = get_user_meta($user_id, 'wcmp_vendor_fields', true);
      Copy

      Now, to display the data in the invoice, you have to override the template file.

      • #78865
        sumanth
        Participant

        Can you specify the path of invoice template and

        also where to add the code(mention code here) for getting a particular field on invoice.

        • #78922

          @sumanth, the template file depends on which invoice template are you using?

          Regarding the code, there is no such ready-made code for this. So, you need to create a custom code on your end.

          • #79277
            sumanth
            Participant

            i’m using wcmp pdf invoice addon . yes please help me regarding displaying particular field(custom vendor registration form field) on invoice.

    • #78444
      sumanth
      Participant

      I have many fields on vendor registration.

      i have a field “VAT number” of vendor registration. how can i get only VAT(provided by vendor) it on invoice .

      help me with the code or an example.

    • #78453

      @sumanth, the $vendor_application_data returns an array, so this will also return the field of VAT. So you need to fetch that field only and display that in the invoice.

      • #78928
        sumanth
        Participant

        i’m using wcmp pdf invoice addon . yes please help me regarding displaying particular field(custom vendor registration form field) on invoice.

    • #79342
      MOUMITA Haldar
      Participant
      This reply has been marked as private.
    • #80189

      Hi @sumanth,
      use

      do_action( 'before_wcmp_pdf_invoice_template', $hook_data );
      Copy

      this hook for displaying registration data on pdf invoice.

      • #80902
        sumanth
        Participant

        need a reference, as im aware of php . please guide me in order to get a particular field(XYZ) while vendor registering through vendor registration form.

    • #81395
      sumit singh
      Moderator

      Hi, when a user register via the registration form, we save their data in user meta. Now you have to fetch that data and display them in the invoice.
      You can get all the registration form data from the user_meta named “wcmp_vendor_fields”, a sample code for you, which returns the data as an array :

      $vendor_application_data = get_user_meta($user_id, 'wcmp_vendor_fields', true);
      	foreach($vendor_application_data as $data) {
      		if($data['label'] == 'custom_field_label') {
      			$custom_field_data = $data['value'];
      		}
      	}
      Copy

      use the following data in below hook to add custom field in invoice

      do_action( 'before_wcmp_pdf_invoice_template', $hook_data );
      Copy
    • #81993
      sumanth
      Participant
      This reply has been marked as private.
    • #83581
      sumit singh
      Moderator


      @sumanth
      , can you share the code you have added, so I can verify that.

    • #83975
      sumanth
      Participant
      This reply has been marked as private.
    • #84497
      sumit singh
      Moderator

      Hi, PLease follow this procedure :
      add a custom field in registration form [e.g. GST no].
      Then put the following code in functions.php of your active theme to display the custom field value in invoice:

      add_action('after_wcmp_pdf_invoice_to_address_details', 'add_field_from_registration');
      function add_field_from_registration() {
      	$user_id = get_current_user_id();
      	$vendor_application_data = get_user_meta($user_id, 'wcmp_vendor_fields', true);
      	foreach($vendor_application_data as $data) {
      		if($data['label'] == 'GST no') {
      			$custom_field_data = $data['value'];
      		}
      	}
      	?>
      	<p><strong style="font-size: 13px; line-height: 16px;"><?php _e('GST no : ', 'wcmp-pdf_invoices'); echo $custom_field_data; ?></p>
          <?php
      }
      Copy
    • #84530
      sumanth
      Participant

      when i use that code, i get error when opening pdf invoice .

      Error:

      There has been a critical error on your website.

      Learn more about debugging in WordPress.

    • #84731

      @sumanth, please share a temporary admin, ftp access so we can check.

      While sharing the access, don’t forget to mark the response as private.

    • #84738
      sumanth
      Participant
      This reply has been marked as private.
    • #85123
      sumit singh
      Moderator

      Hi, I have fixed the critical error in your site and added the code for GSTIN field.
      now, register a vendor and add value for GSTIN field and order a product to see respective value in invoice.

    • #85149
      sumanth
      Participant
      This reply has been marked as private.
    • #85181
      sumanth
      Participant
      This reply has been marked as private.
    • #85243
      This reply has been marked as private.
    • #85250
      sumanth
      Participant
      This reply has been marked as private.
    • #85670
      sumanth
      Participant
      This reply has been marked as private.
    • #85761
      This reply has been marked as private.
    • #85764
      sumanth
      Participant
      This reply has been marked as private.
    • #85804
      sumanth
      Participant
      This reply has been marked as private.
    • #85805
      This reply has been marked as private.
    • #86485
      sumanth
      Participant
      This reply has been marked as private.
    • #86649
      This reply has been marked as private.
    • #86683
      sumanth
      Participant
      This reply has been marked as private.
    • #86685
      This reply has been marked as private.
    • #85841
      sumanth
      Participant
      This reply has been marked as private.
    • #100988
      This reply has been marked as private.
Viewing 31 reply threads

Please LOGIN to reply to this topic

Buy any WCMp product at 20% discount, use code "FREEDOM20" or, buy bundle at a slashed price

Buy at Slashed Price