• Hi,

    How can I get the product vendor to show next to each item ordered?

    I use WooCommerce Product Vendors.

    Many thanks,

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi,

    Here’s a code snippet that will add the Product Vendor name to the PDF:

    add_action( 'wpo_wcpdf_after_item_meta', 'wpo_wcpdf_show_product_vendor', 10, 3 );
    function wpo_wcpdf_show_product_vendor ( $template_type, $item, $order ) {
    	if ( ! empty( $item['product_id'] ) && WC_Product_Vendors_Utils::is_vendor_product( $item['product_id'] ) ) {
    		$sold_by = WC_Product_Vendors_Utils::get_sold_by_link( $item['product_id'] );
    
    		$sold_by_text = apply_filters( 'wcpv_sold_by_text', esc_html__( 'Sold By:', 'woocommerce-product-vendors' ) );
    		$link = esc_url( $sold_by['link'] );
    		$title = esc_attr( $sold_by['name'] );
    		$name = $sold_by['name'];
    
    		printf('<br /><em class="wcpv-sold-by-order-details">%s <a href="%s" title="%s">%s</a></em>', $sold_by_text, $link, $title, $name );
    	}
    }

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    • This reply was modified 6 years, 3 months ago by kluver.
    • This reply was modified 6 years, 3 months ago by kluver.
    Thread Starter sebodell

    (@sebodell)

    Thanks. That worked perfectly.

    How can I add the functionality to a ‘Vendor Admin’ to print their own packing list?

    Plugin Contributor kluver

    (@kluver)

    Hi @sebodell,

    The snippet should add vendor data to all PDF documents. Also when vendors create PDFs.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WooCommerce Product Vendors’ is closed to new replies.