Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards!

Vendor Orders Csv Replace Discount Column with SKU

WCMp Core

Resolved
Viewing 3 reply threads
  • Author
    Posts
    • #125120
      mikestar
      Participant

      Hi,

      When a Vendor downloads Orders in csv file, then there is a column in csv called ‘Discount Used’

      How to replace this column ‘Discount Used’ with ‘SKU’ of the products in the order ?

      Thanks,
      Mike

    • #125165

      Hi,
      As per your requirement you have to add custom code. kindly use below filter and add your custom code.
      For CSV Header–

      wcmp_vendor_order_generate_csv_headers
      Copy

      For CSV Data —

      wcmp_vendor_order_generate_csv_data
      Copy

      Regards,

    • #125191
      mikestar
      Participant

      Hi,

      Have added the following custom code to function.php active theme file. But after adding, when tried to download bulk orders from vendor dashboard then it does not work and site throws error.

      Can you pls help?

      Following code was added:

      add_filter( 'wcmp_vendor_order_generate_csv_headers', 'add_extra_coloumn_header' );
      function add_extra_coloumn_header( $header ) {
      	 $header['product_sku'] = __('Product SKU', 'dc-woocommerce-multi-vendor');
      	 return $header;
      }
      
      add_filter( 'wcmp_vendor_order_generate_csv_data', 'add_extra_coloumn_data', 10, 3 );
      function add_extra_coloumn_data( $data, $customer_order, $vendor ) {
      	$item_sku = array();
      	$vendor_items = $vendor->get_vendor_items_from_order($customer_order, $vendor->term_id);
      	if($vendor_items){
      		foreach ($vendor_items as $item) {
              $product = wc_get_product( $item['product_id'] );
              $item_sku[] = $product->get_sku();
          	}
      	}
      	$data['product_sku'] = isset($item_sku) ? implode(', ',  $item_sku) : '';
      	return $data;
      }
      Copy
    • #125226

      Hi,
      We have check this code on our end and it’s working fine. Checkout the video – https://www.loom.com/share/1c68459c4bcd467f98c45ac7f49065d9

      If you facing any issue kindly share a detailed video.

      Regards,

Viewing 3 reply threads

The topic ‘Vendor Orders Csv Replace Discount Column with SKU’ is closed to new replies.