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.