Home Forums WC Vendors Free Support How can I Let Vendors See Customer Phone Number in Order Details?

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #36076
    George
    Participant

    Hey Guys,

    I’ve been using the free version of the plugin for a bit. I love it and will buy PRO once bookings support finally comes out (been following since December).

    Anyways, is there a way for vendors to see customers’ phone numbers alongside of their email address in the order details screen? I feel like this should be a default feature, or is it PRO only (although I didn’t see phone numbers in the pro demo)? The vendors do get phone numbers in order EMAILS, but no one wants to look through those to get all customer info. I run an event tickets website, so it’s important that they get phone #’s just in case an event is cancelled or postponed.

    Thanks!

    #36217
    WC Vendors Support
    Participant

    Use this code as a starting point — It’s meant to show emails, but you can figure out how to tweak it to show a phone instead. Should work fine, in Free & Pro. 🙂

    Cheers

    https://gist.github.com/bentasm1/024426b661193c7fd3a7

    #37963
    George
    Participant

    Sorry for the late response. I didn’t get an email notification after your reply.

    You may have misread my question.

    I would like for the vendor (the seller of whatever product) to be able to see the customer’s phone number, not just the email address, when they are viewing and managing their orders on the order details page in their vendor dashboard.

    My vendors need to see customer phone numbers in order to notify them of things via text message or to sign them in for events

    Thanks

    #38138
    WC Vendors Support
    Participant

    Aah, I see. You would have to edit the order templates that come with WC Vendors Free to hook into them, or modify them, to pull the phone number and show it. The KnowledgeBase has a list of all the templates in the WC Vendors Free Setup Guide, as well as instructions on how to copy template files.

    #38376
    George
    Participant

    Hey Ben, your answer was a bit off. The template actually just calls variables defined in the wc-vendors/classes/front/orders/class-orders.php file.

    I edited that for now in 2 parts:

    Under public function get_headers()

    There’s an array. I inserted the phone number under the email address (and fixed the non-capitalized “A” in address) like so:

    'email'   => __( 'Email Address', 'wcvendors' ),
    'phone'   => __( 'Phone Number' , 'wcvendors' ),

    The you have to go to public function format_order_details( $orders, $product_id )

    and insert again like so:

    'email'        => $order->billing_email,
    'phone'        => $order->billing_phone,

    I’m sure a hook can be used, but until I learn more php, this is good enough for me. Please please please include this option in your next version!

    #38380
    George
    Participant

    Actually, it took me 2 minutes to make that option, so now you have to put it in the next version =P

    1. In wc-vendors/classes/admin/settings/sf-options.php

    I pasted this under the options for ‘View email addresses’:

    $options[ ] = array(
    	'desc' => __( 'View phone numbers', 'wcvendors' ),
    	'tip'  => __( 'While viewing order details on the frontend, you can disable or enable phone numbers', 'wcvendors' ),
    	'id'   => 'can_view_order_phone',
    	'type' => 'checkbox',
    	'std'  => true,
    );

    2. And then back in wc-vendors/classes/front/orders/class-orders.php

    first, the top of the form will have this:

    	function __construct()
    	{
    		$this->can_view_orders = WC_Vendors::$pv_options->get_option( 'can_show_orders' );
    		$this->can_export_csv  = WC_Vendors::$pv_options->get_option( 'can_export_csv' );
    		$this->can_view_emails = WC_Vendors::$pv_options->get_option( 'can_view_order_emails' );
    
    		add_action( 'template_redirect', array( $this, 'check_access' ) );
    		add_action( 'wp', array( $this, 'display_shortcodes' ) );
    		add_shortcode( 'wcv_orders', array( $this, 'display_product_orders' ) );
    	}

    Change it to this:

    	function __construct()
    	{
    		$this->can_view_orders = WC_Vendors::$pv_options->get_option( 'can_show_orders' );
    		$this->can_export_csv  = WC_Vendors::$pv_options->get_option( 'can_export_csv' );
    		$this->can_view_emails = WC_Vendors::$pv_options->get_option( 'can_view_order_emails' );
    		$this->can_view_phone = WC_Vendors::$pv_options->get_option( 'can_view_order_phone' );
    
    		add_action( 'template_redirect', array( $this, 'check_access' ) );
    		add_action( 'wp', array( $this, 'display_shortcodes' ) );
    		add_shortcode( 'wcv_orders', array( $this, 'display_product_orders' ) );
    	}

    find public function get_headers()

    and then under

    		if ( !$this->can_view_emails ) {
    			unset( $headers[ 'email' ] );
    		}

    paste this:

    		if ( !$this->can_view_phone ) {
    			unset( $headers[ 'phone' ] );
    		}

    and finally at public function format_order_details( $orders, $product_id )

    under

    			if ( !$this->can_view_emails ) {
    				unset( $body[ $i ][ 'email' ] );
    			}

    paste this:

    			if ( !$this->can_view_phone ) {
    				unset( $body[ $i ][ 'phone' ] );
    			}

    **Just a note, you have to actually go back to the WC Vendors->Capabilities settings and save them before they take effect

    And there you go. Now you have the option to enable or disable vendors from seeing customers’ phone numbers in order details. The table looks fine and the phone number shows up in the CSV Export as well. I don’t know how to do Github, so I hope someone can do this for me if you decide to use this feature. Thx

    #40756
    George
    Participant

    Just sent pull requests for changes to these two files. Thanks

    #40787
    Jamie
    Keymaster

    Hello,

    When sending a pull request, please combine all changes for a single feature update into a single pull request. Only submit separate pull requests when the code isn’t related thanks.

    cheers,

    Jamie.

    #40792
    George
    Participant

    Sorry,

    I mentioned that I didn’t know how to use Github, but no one replied to the thread so I figured I’d try and add the changes myself =)

    #40793
    Jamie
    Keymaster

    Hello,

    Yeah to create a multiple file pull request, just make all the changes you need and then create the pull request and it’ll include all the files. It’s much easier if you’re using a desktop github client. Grab the one from github.com for your operating system. I’ll make things a LOT easier 🙂

    cheers,

    Jamie.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘WC Vendors Free Support’ is closed to new topics and replies.