Display "Country" + "State/County" + "City/Town" in single product page.

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Membership Display "Country" + "State/County" + "City/Town" in single product page.

Viewing 8 reply threads
  • Author
    Posts
    • #122157
      ing.rapparini
      Participant

      I need to display “Country” + “State/County” + “City/Town” of the vendor in single product page “woocommerce_product_meta_end” position.

      (These values are those that the seller entered during registration).

      How can I get it?

      Thanks

      Attachments:
      You must be logged in to view attached files.
    • #122350
      Craig
      Participant

      I vote for this as well.

      it would be good to display the location in addition to the shop name on the product page

    • #122478
      Sushobhan
      Keymaster

      Hello,
      You can use the following snippet (do changes as per your need)-

      add_action('woocommerce_product_meta_end', function() {
          global $product;
          $vendor_id = wcfm_get_vendor_id_by_post($product->get_id());
          ?>
          <div class="vendor_singleline_address"><?php echo wcfm_get_vendor_store_address_by_vendor($vendor_id); ?></div>
          <?php
      });

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/
      Let me know how this goes.
      Thanks!

    • #122498
      ing.rapparini
      Participant

      This show ALL the address!!!
      And is not good for privacy…

      Can you do what I m asking in my previous pic (also with the same pagination)?

      Thanks

    • #122501
      Sushobhan
      Keymaster

      Kindly use this updated snippet-

      add_action( 'woocommerce_product_meta_end', function() {
          global $product;
          $vendor_id = wcfm_get_vendor_id_by_post( $product->get_id() );
          $store_user = wcfmmp_get_store( $vendor_id );
          $store_info = $store_user->get_shop_info();
          if ( $store_info['store_hide_address'] == 'yes' || ! wcfm_vendor_has_capability( $vendor_id, 'vendor_address' ) )
              return;
          if ( ! empty( $store_info['address'] ) ) {
              $addr_arr = array();
              $all_countries = WC()->countries->get_countries();
              if ( ! empty( $store_info['address']['country'] ) && ! empty( $all_countries[$store_info['address']['country']] ) ) {
                  array_push( $addr_arr, $all_countries[$store_info['address']['country']] );
                  if ( ! empty( $store_info['address']['state'] ) )
                      array_push( $addr_arr, $store_info['address']['state'] );
                  if ( ! empty( $store_info['address']['city'] ) )
                      array_push( $addr_arr, $store_info['address']['city'] );
                  ?>
                  <p class="vendor_singleline_address"><span>Country: </span><?php _e( implode( ", ", $addr_arr ) ); ?></p>
                  <?php
              }
          }
      } );

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/
      Let me know how this goes.
      Thanks!

    • #122528
      ing.rapparini
      Participant

      THAT IS AWESOME!

      THANK YOU VERY MUCH!!!

    • #122558
      Sushobhan
      Keymaster

      You are always welcome ­čÖé
      Let me know if there’s anything else we can help you with.
      Can we ask for a favor? Would you mind taking a few minutes to review our plugin at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers.

    • #122698
      ing.rapparini
      Participant

      Yes…you can do something else :-)))

      I have a filter that can filter for “META”. (Product Filter by XforWoocommerce)

      What is the “meta” I can use for “country”?

    • #122831
      Sushobhan
      Keymaster

      Country is not stored as an individual meta. You can get complete vendor setting fields using ‘wcfmmp_profile_settings’ meta like this-
      $shop_info = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true );
      It return an array with key name ‘address’, which is again an array stored in the following format-

      [address] => Array (
          [street_1] => 
          [street_2] => 
          [city] => 
          [zip] => 
          [country] => IN
          [state] => WB
      )

      Hope it clarifies everything!

Viewing 8 reply threads
  • You must be logged in to reply to this topic.
    Glastrennw├Ąnde
    blumen verschicken Blumenversand
    blumen verschicken Blumenversand
    Reinigungsservice Reinigungsservice Berlin
    k├╝chenrenovierung k├╝chenfronten renovieren k├╝chenfront erneuern