Orders table, earnings, commissions and shipping cost

WCMp Advanced Frontend Manager

Resolved
Viewing 7 reply threads
  • Author
    Posts
    • #146251
      ig
      Participant

      How can we add commission and shipping columns to the Orders table on the vendor dashboard …/dashboard/vendor-orders/ ?

      Earnings column shows the total of commission + shipping, we want to split this value because we charge vendor a commission and customer pays shipping cost directly to the courier service.

      We’ve enabled option in the plugin settings: If enabled vendor can configure their shipping on dashboard. Our commission type is percentage, commission value 85%

    • #146277
      promita
      Keymaster

      Hi Ivan Gacesa, In order to add commission and shipping columns to the Orders table on the vendor dashboard, add this code in functions.php of your child theme :

      
      /* add additional column in vendor order table */
      add_filter('mvx_datatable_order_list_table_headers', 'add_column_in_order_table_vendor', 10, 2);
      function add_column_in_order_table_vendor($orders_list_table_headers, $current_user_id) {
      	$orders_list_table_headers['commission'] =  array('label' => __( 'Commission', 'multivendorx' ));
      	$orders_list_table_headers['shipping_charge'] =  array('label' => __( 'Shipping', 'multivendorx' ));
      	return $orders_list_table_headers;
      }
      
      /* display value in additional column in vendor order table */
      add_filter('mvx_datatable_order_list_row', 'display_value_in_order_table_vendor', 10, 2);
      function display_value_in_order_table_vendor($vendor_rows, $order) {
          $commission_id = get_post_meta($order->get_id(), '_commission_id', true);
          $commission_amount =  get_post_meta( $commission_id, '_commission_amount', true );
      	$vendor_rows['shipping_charge'] = $order->get_shipping_total();
      	$vendor_rows['commission'] = $commission_amount;
      	return $vendor_rows;
      }
      
      Copy

      Let us know if you have any further query.

    • #146390
      ig
      Participant

      Thanks promita,

      It works with multivendorX, but we had to downgrade to WC-marketplace 3.9.3 because multiVendorX has a lot of problems with settings which is not migrated from wcmp to multivendorX (payment, store front etc.) and your plugins Advanced Frontend Manager, WCMp Advanced Vendor Report, Loco translate and all wcmp custom snippets, css. I will add another post for it.

      Can you change snippet code for commission and shipping columns for the last WC marketplace 3.9.3?

      Thanks in advance

    • #146391
      promita
      Keymaster

      Hi Ivan Gacesa, In WC-marketplace 3.9.3, add this code in functions.php of your child theme :

      
      /* add additional column in vendor order table */
      add_filter('wcmp_datatable_order_list_table_headers', 'add_column_in_order_table_vendor', 10, 2);
      function add_column_in_order_table_vendor($orders_list_table_headers, $current_user_id) {
      	$orders_list_table_headers['commission'] =  array('label' => __( 'Commission', 'multivendorx' ));
      	$orders_list_table_headers['shipping_charge'] =  array('label' => __( 'Shipping', 'multivendorx' ));
      	return $orders_list_table_headers;
      }
      
      /* display value in additional column in vendor order table */
      add_filter('wcmp_datatable_order_list_row_data', 'display_value_in_order_table_vendor', 10, 2);
      function display_value_in_order_table_vendor($vendor_rows, $order) {
          $commission_id = get_post_meta($order->get_id(), '_commission_id', true);
          $commission_amount =  get_post_meta( $commission_id, '_commission_amount', true );
      	$vendor_rows['shipping_charge'] = $order->get_shipping_total();
      	$vendor_rows['commission'] = $commission_amount;
      	return $vendor_rows;
      }
      
      Copy

      Let us know if you have any further query.

    • #146393
      ig
      Participant

      Thanks, it works.

      How can we change the order of the columns, move columns commission and shipping before earnings (3rd and 4th position)?

    • #146401

      @ig, our team will assit you with this.

      In the mean time, We would love it if you shared your experience by giving us 5/5 review here : https://wordpress.org/support/plugin/dc-woocommerce-multi-vendor/reviews/#new-post

    • #146510
      promita
      Keymaster

      @ig, In order to change the order of the columns, you can override the vendor-orders.php file to your theme and change line no- 17-24 of this code:

      
      $orders_list_table_headers = apply_filters('wcmp_datatable_order_list_table_headers', array(
          'select_order'  => array('label' => '', 'class' => 'text-center'),
          'order_id'      => array('label' => __( 'Order ID', 'dc-woocommerce-multi-vendor' )),
          'order_date'    => array('label' => __( 'Date', 'dc-woocommerce-multi-vendor' )),
          'commission'    => array('label' => __( 'Commission', 'dc-woocommerce-multi-vendor' )),
          'shipping_charge' => array('label' => __( 'Shipping', 'dc-woocommerce-multi-vendor' )),
          'vendor_earning'=> array('label' => __( 'Earnings', 'dc-woocommerce-multi-vendor' )),
          'order_status'  => array('label' => __( 'Status', 'dc-woocommerce-multi-vendor' )),
          'action'        => array('label' => __( 'Action', 'dc-woocommerce-multi-vendor' )),
      ), get_current_user_id());
      
      Copy

      and add this code in functions.php of your child theme :

      
      /* display value in additional column in vendor order table */
      add_filter('wcmp_datatable_order_list_row_data', 'display_value_in_order_table_vendor', 10, 2);
      function display_value_in_order_table_vendor($vendor_rows, $order) {
          $commission_id = get_post_meta($order->get_id(), '_commission_id', true);
          $commission_amount =  get_post_meta( $commission_id, '_commission_amount', true );
      	$vendor_rows['shipping_charge'] = $order->get_shipping_total();
      	$vendor_rows['commission'] = $commission_amount;
      	return $vendor_rows;
      }
      
      Copy

      Let us know if you have any further query.

    • #146576
      ig
      Participant

      Thanks @promita!

Viewing 7 reply threads

The topic ‘Orders table, earnings, commissions and shipping cost’ is closed to new replies.