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.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

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

    Hi,

    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?

    Thanks.

    • This topic was modified 5 years, 9 months ago by Pablo.
    #61870
    Pablo
    Participant

    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.

    #61986
    Anna
    Member

    @pafly
    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. 😉

    #61999
    Pablo
    Participant

    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?

    Thanks

    #62033
    Anna
    Member

    Pablo,
    Sure!
    So in this file (WC Vendors free):
    wp-content/wc-vendors/classes/front/class-vendor-shop.php
    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:
    https://gist.github.com/fervous/256aea509c89191feffd330d2b27b5a0

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.
This website uses cookies to ensure you get the best experience on our website.