Home Forums WC Vendors Pro Support Turn Sold by meta text into vendor's store URL

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.


Thank you to all of our customers!


Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #61779


    So on customer’s order page, there is “Sold by” field which is displaying vendor’s meta. However it is only a text, it’s not a vendor’s store URL. I would like to turn this text into vendor’s store URL. So when clicked on that meta info to take the customer to a vendor’s store. I attached a picture. How can I achieve this?



    I think this is essential as customers should be able to easily go to vendor’s store after purchasing a product (in order to contact a vendor or similar). Right now it’s a bit confusing as they don’t know how to reach vendor’s store page after purchasing a product.


    Hello Pablo,
    I’ve seen your requests—
    I’m working on it… we had to make some changes for the new WooCommerce, which adds a bit of extra code to work around for this to be changed. 😉


    Hi Anna, thanks for the response.. I understand…

    It would be cool if you can give me a peak on which files are handling this so I could have a look myself and try to help you out for this to be changed?



    So in this file (WC Vendors free):
    lines 39-46 you’ll find the action hooks used:

    // Show vendor on all sales related invoices 
      if ( version_compare( WC_VERSION, '2.7', '<' ) ) { 	
       add_action( 'woocommerce_add_order_item_meta', array( $this, 'add_vendor_to_order_item_meta_legacy' ), 50, 2 ); 
      } else { 	
       add_action( 'woocommerce_checkout_create_order_line_item', array( $this, 'add_vendor_to_order_item_meta' ), 50, 3 ); } 

    And then on lines 319-332 of the same file, you’ll find the function:

    public function add_vendor_to_order_item_meta( $item, $cart_item_key, $values ) {
    		$cart      	= WC()->cart->get_cart();
    		$cart_item 	= $cart[ $cart_item_key ]; 
    		$product_id 	= $cart_item['data']->get_id();
    		$post 		= get_post( $product_id ); 
    		$vendor_id 	= $post->post_author;  
    		$sold_by_label 	= WC_Vendors::$pv_options->get_option( 'sold_by_label' ); 
    		$sold_by 	= WCV_Vendors::is_vendor( $vendor_id ) ? sprintf( WCV_Vendors::get_vendor_sold_by( $vendor_id ) ): get_bloginfo( 'name' );
    		$item->add_meta_data( apply_filters( 'wcvendors_sold_by_in_email', $sold_by_label ), $sold_by );
    } // add_vendor_to_order_item_meta() 

    Now this Gist below shows what I have so far– all of this *should* work from what I can tell, but it is not currently changing to the link. I believe that the if statement added for the 2.7+ upgrade is interfering, or I need to alter the $sold_by and $store_url further:

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