• Resolved WP Native

    (@nazreenexe)


    I use Dokan pro in conjunction with woocommerce and I wanted to add a new column to WooCommerce orders list (Woocommerce> orders) which should contain the stores commission in value. I found this article which is very helpful to add new column to above mentioned scenario. However I’m stuck on how to fetch the commission datas against each order.

    Please help @rur165 ????

    • This topic was modified 4 years, 3 months ago by WP Native.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter WP Native

    (@nazreenexe)

    I found piece of this code which output the product. Can I add commissions instead?

    add_filter( 'manage_edit-shop_order_columns', 'show_product_order',15 );
    function show_product_order($columns){
    
       //add column
       $columns['product-display'] = __( 'Products'); 
    
       return $columns; 
    }
    
    add_action( 'manage_shop_order_posts_custom_column' , 'snv_custom_shop_order_column', 10, 2 );
    function snv_custom_shop_order_column( $column ) {
     global $post, $woocommerce, $the_order;
    
        switch ( $column ) {
    
            case 'product-display' :
                $terms = $the_order->get_items();
    
              if ( is_array( $terms ) ) {
                    foreach($terms as $term)
            {
            echo $term['item_meta']['_qty'][0] .' x ' . $term['name'] .'
    ';
            }
                  } else {
                    _e( 'Unable get the products', 'woocommerce' );
            }
                break;
    
        }
    }
    • This reply was modified 4 years, 3 months ago by WP Native.

    Hello @nazreenexe ,

    We already have a reports section in Dokan Pro which shows the admin commission per order separately. I can share you the code reference so that you get an idea of how we are pulling the information from the database and calculating the commission per order.

    See the full code here – https://gist.github.com/rashedripon/e05492c5072cf63d37984000edc773a2#file-logscontroller-php-L112

    I hope this gives you a starting point to make the expected customizations.

    Thank you.

    Hey @nazreenexe

    We also looking for such a solution. Maybe you can share your experience afterwards? ??

    Many thanks!

    Cheers

    Thread Starter WP Native

    (@nazreenexe)

    @rur165 Thank you. Would you be open to share the code snippet? So that will help myself others too.????

    Hello all,

    I have made the GIST public. You can get the initial idea from there as that code is doing exactly what you are expecting.

    I will not be able to make the exact solution here as that will violate our support policy to develop a custom solution for a request.

    I hope this is understandable ??

    Thank you.

    hello @nazreenexe

    Did you had any success with the code snipped from Rashed?

    Cheers

    Hello @nazreenexe

    Was you able to implement the hints from Rashed? We are looking for the exaxt same solution as you. ??

    Cheers

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add new column to WooCommerce orders list column’ is closed to new replies.