Want to show the Phone number of Vendor

WCMp Vendor Staff

Resolved
Viewing 3 reply threads
  • Author
    Posts
    • #133010
      BS
      Participant

      Hi,
      I’m trying to echo the vendor phone number field on the product details page. What will be the PHP or short code to show the number?
      I tried to echo it on the product page but its’s now showing me…I added the screenshot below.

    • #133045

      Hi,
      Please add this code in the function.php of the current active theme :

      add_action('woocommerce_single_product_summary','phoneno_additional_text');
      function phoneno_additional_text() {
          if( is_user_logged_in() ){
              global $post;
              $author_id = $post->post_author;
              $phone_no = metadata_exists('user',$author_id ,'_vendor_phone') ? get_user_meta($author_id ,'_vendor_phone',true) : '';
              if( !empty( $phone_no ) ) echo 'Vendor Contact No : '.$phone_no.'<br>';
          }
      }
      Copy

      Regards,

    • #133118
      BS
      Participant

      Hi,
      Thanks for your code i added the code but it’s not printing the vendor number…My logic is so simple like user logged in they can see the product vendor phone number by clicking the button. i just echo the number it’s not showing the number can you help me why it’s not showing?
      add the screenshot below.
      Thanks.

    • #133154

      Hi,
      Using the above code vendor phone no is soon in single product page.
      Kindly checkout the video- https://gdskavr9sw.vmaker.com/record/vZYCyuZb5UjBffHf

      kindly make sure vendor has set a phone number from vendor dashboard >> store settings >> storefront.

      Regards,

Viewing 3 reply threads

The topic ‘Want to show the Phone number of Vendor’ is closed to new replies.