title: How to show custom metadata on the frontend wit WP Store Locator?
body: <p>I want to add a custom text on the info windows below the Store information (below Email).</p>
  
  <p><a href="https://i.stack.imgur.com/2ItMW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2ItMW.jpg" alt="example"></a></p>
  
  <p>I am following the instruction from:</p>
  
  <p><a href="https://wpstorelocator.co/document/add-custom-meta-data-to-store-locations/" rel="nofollow noreferrer">https://wpstorelocator.co/document/add-custom-meta-data-to-store-locations/</a></p>
  
  <p>So, I added the following on the function.php file of the worpress theme:</p>
  
  <pre><code>// adding my_textinput field
  add_filter( 'wpsl_meta_box_fields', 'custom_meta_box_fields' );
  
  function custom_meta_box_fields( $meta_fields ) {
  
      $meta_fields[__( 'Additional Information', 'wpsl' )] = array(
          'phone' =&gt; array(
              'label' =&gt; __( 'Tel', 'wpsl' )
          ),
          'fax' =&gt; array(
              'label' =&gt; __( 'Fax', 'wpsl' )
          ),
          'email' =&gt; array(
              'label' =&gt; __( 'Email', 'wpsl' )
          ),
          'url' =&gt; array(
              'label' =&gt; __( 'Url', 'wpsl' )
          ),
          'my_textinput' =&gt; array(
              'label' =&gt; __( 'Textinput', 'wpsl' )
          )
      );
  
      return $meta_fields;
  }
  
  // add my_textinput in to the json response
  function custom_frontend_meta_fields( $store_fields ) {
  
      $store_fields['wpsl_my_textinput'] = array( 
          'name' =&gt; 'my_textinput',
          'type' =&gt; 'text'
      );
  
      return $store_fields;
  }
  
  
  // show my_textinput into the frontend on info window
  add_filter( 'wpsl_info_window_template', 'custom_info_window_template' );
  
  function custom_info_window_template() {
  
      global $wpsl_settings, $wpsl;
  
      $info_window_template = '&lt;div data-store-id="&lt;%= id %&gt;" class="wpsl-info-window"&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;p&gt;' . "\r\n";
      $info_window_template .= "\t\t\t" .  wpsl_store_header_template() . "\r\n";  
      $info_window_template .= "\t\t\t" . '&lt;span&gt;&lt;%= address %&gt;&lt;/span&gt;' . "\r\n";
      $info_window_template .= "\t\t\t" . '&lt;% if ( address2 ) { %&gt;' . "\r\n";
      $info_window_template .= "\t\t\t" . '&lt;span&gt;&lt;%= address2 %&gt;&lt;/span&gt;' . "\r\n";
      $info_window_template .= "\t\t\t" . '&lt;% } %&gt;' . "\r\n";
      $info_window_template .= "\t\t\t" . '&lt;span&gt;' . wpsl_address_format_placeholders() . '&lt;/span&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;/p&gt;' . "\r\n";
  
      $info_window_template .= "\t\t" . '&lt;% if ( phone ) { %&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;span&gt;&lt;strong&gt;' . esc_html( $wpsl-&gt;i18n-&gt;get_translation( 'phone_label', __( 'Phone', 'wpsl' ) ) ) . '&lt;/strong&gt;: &lt;%= formatPhoneNumber( phone ) %&gt;(1)&lt;/span&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;% } %&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;% if ( fax ) { %&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;span&gt;&lt;strong&gt;' . esc_html( $wpsl-&gt;i18n-&gt;get_translation( 'fax_label', __( 'Fax', 'wpsl' ) ) ) . '&lt;/strong&gt;: &lt;%= fax %&gt;(2)&lt;/span&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;% } %&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;% if ( email ) { %&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;span&gt;&lt;strong&gt;' . esc_html( $wpsl-&gt;i18n-&gt;get_translation( 'email_label', __( 'Email', 'wpsl' ) ) ) . '&lt;/strong&gt;: &lt;%= formatEmail( email ) %&gt;(3)&lt;/span&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;% } %&gt;' . "\r\n";
  
      /**
       * Include the data from a custom field called 'my_textinput'.
       * 
       * Before you can access the 'my_textinput' data in the template, 
       * you first need to make sure the data is included in the JSON output.
       * 
       * You can make the data accessible through the wpsl_frontend_meta_fields filter.
       * 
       * 
       */
  
      $info_window_template .= "\t\t" . '&lt;% if ( my_textinput ) { %&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;p&gt;&lt;%= my_textinput %&gt;&lt;/p&gt;' . "\r\n";
      $info_window_template .= "\t\t" . '&lt;% } %&gt;' . "\r\n";
  
      $info_window_template .= "\t\t" . '&lt;%= createInfoWindowActions( id ) %&gt;' . "\r\n";
      $info_window_template .= "\t" . '&lt;/div&gt;' . "\r\n";
  
      return $info_window_template;
  }
  </code></pre>
  
  <p>When I add the following piece of code (almost a the end) the info windows doesn't show:</p>
  
  <pre><code>$info_window_template .= "\t\t" . '&lt;% if ( my_textinput ) { %&gt;' . "\r\n";
  $info_window_template .= "\t\t" . '&lt;p&gt;&lt;%= my_textinput %&gt;&lt;/p&gt;' . "\r\n";
  $info_window_template .= "\t\t" . '&lt;% } %&gt;' . "\r\n";
  </code></pre>
  
  <p>And I am getting the following error on DevTool console:</p>
  
  <pre><code>Uncaught ReferenceError: my_textinput is not defined
      at eval (eval at m.template (underscore.min.js?ver=1.8.3:5), &lt;anonymous&gt;:52:2)
      at c (underscore.min.js?ver=1.8.3:5)
      at H (wpsl-gmap.min.js?ver=2.2.15:1)
      at _.ze.&lt;anonymous&gt; (wpsl-gmap.min.js?ver=2.2.15:1)
      at Object.trigger ...
  </code></pre>
  
  <p>How can I make sure the data is included in the JSON output?</p>