Home Forums WC Vendors Pro Support class-vendor-cart.php

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 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #58712
    patrick
    Participant

    On the order recieved page, that shows after checkout, there is a “Sold By” label along with the vendors name.

    I would like to add the vendors address and phone number.

    I believe I have the correct page to modify “class-vendor-cart.php” shown below.

    Can anyone tell me what code to add to this page to make it possible?

    The closest I found to this issue by searching is someone wanting to add the same information to the email invoice. That solution is here (scroll down) :ml/wp-content/plugins/wc-vendors/classes/front/orders/class-orders.php

    I did take some oof that code and paste it on “class-vendor-cart.php” with no luck.

    Can someone tell me what code to add to the code below so the vendors address and phone number would show under there vendor name? thanks

    `<?php

    /**
    *
    *
    * @author Matt Gates <http://mgates.me&gt;
    * @package
    */

    class WCV_Vendor_Cart
    {

    /**
    *
    */
    function __construct()
    {

    if ( WC_Vendors::$pv_options->get_option( ‘sold_by’ ) ) {
    add_filter( ‘woocommerce_get_item_data’, array( ‘WCV_Vendor_Cart’, ‘sold_by’ ), 10, 2 );
    add_action( ‘woocommerce_product_meta_start’, array( ‘WCV_Vendor_Cart’, ‘sold_by_meta’ ), 10, 2 );
    }

    }

    /**
    * Sold by in cart item
    *
    * @param unknown $values
    * @param unknown $cart_item
    *
    * @return unknown
    */
    public static function sold_by( $values, $cart_item )
    {
    $vendor_id = $cart_item[ ‘data’ ]->post->post_author;
    $sold_by_label = WC_Vendors::$pv_options->get_option( ‘sold_by_label’ );
    $sold_by = WCV_Vendors::is_vendor( $vendor_id )
    ? sprintf( ‘%s ‘, WCV_Vendors::get_vendor_shop_page( $vendor_id ), WCV_Vendors::get_vendor_sold_by( $vendor_id ) )
    : get_bloginfo( ‘name’ );

    $values[ ] = array(
    ‘name’ => apply_filters(‘wcvendors_cart_sold_by’, $sold_by_label, $cart_item[ ‘data’ ]->post->ID, $cart_item[ ‘data’ ]->post->post_author ),
    ‘display’ => $sold_by,
    );

    return $values;
    }

    /**
    * Single product meta
    */
    public static function sold_by_meta()
    {
    $vendor_id = get_the_author_meta( ‘ID’ );
    $sold_by_label = WC_Vendors::$pv_options->get_option( ‘sold_by_label’ );
    $sold_by = WCV_Vendors::is_vendor( $vendor_id )
    ? sprintf( ‘%s‘, WCV_Vendors::get_vendor_shop_page( $vendor_id ), WCV_Vendors::get_vendor_sold_by( $vendor_id ) )
    : get_bloginfo( ‘name’ );

    echo apply_filters(‘wcvendors_cart_sold_by_meta’, $sold_by_label, get_the_ID(), $vendor_id ) .’ ‘. $sold_by . ‘<br/>’;
    }

    }

    #58718
    Jamie
    Keymaster

    Hello,

    You don’t have to modify the core classes to get more information into the sold by data. All the sold by data is is order item meta. Once you have the vendor ID its very easy to add extra fields such as the vendors phone number or address. This would be custom coding outside the scope of our support though.

    cheers,

    Jamie.

    #58729
    patrick
    Participant

    Can you tell me were to find this “order item meta” so i have a starting point. Thanks

    #64346
    JAVIER
    Participant

    I also need this option, and it’s such a basic thing that should be included in the pro package. This is the only way to communicate directly with the seller after making a purchase …

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