RE: Refund are not shoing

WCMp Core

RE: Refund are not shoing Open

Viewing 16 reply threads
  • Author
    Posts
    • #113065
      print88
      Participant

      The Refund amount is not showing in the Woocommerce report.
      I have narrowed down to a WCMP plugin problem.
      I tried deactivating WCMP and the refund amount is shown.
      Once activated, the refund amount is zeroed, but shown # of returned items.

    • #113117

      Hello,

      Thank you for reaching out to us.

      We found the issue at our end and our team is working on it. You can track it from here (https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/issues/625).

    • #113203
      print88
      Participant

      Any update on this Major issue? Because this is causing a major problem with accounting.

    • #113310
      Fantastic Kuhu
      Keymaster

      Hi @print88,

      This has already being assigned to development team and they are already looking into it.

    • #113471

      Hi @print88,
      Please use this code in your currently active theme functions.php file and let us know the issue is fixed or not

      
      add_filter( 'woocommerce_admin_report_data', function($report_data){
          
          $child_orders_for_partial = array();
          if (is_array($report_data->partial_refunds) && !empty($report_data->partial_refunds)) {
              foreach ($report_data->partial_refunds as $refund_key => $refund_value) {
                  $refund = new WC_Order_Refund( $refund_value->refund_id );
                  if ( is_object( $refund ) && !wp_get_post_parent_id($refund->get_parent_id())) {
                      $child_orders_for_partial[] = $refund_value;
                  }
              }
          }
          
          $child_orders_refund_lines = array();
          if (is_array($report_data->refund_lines) && !empty($report_data->refund_lines)) {
              foreach ($report_data->refund_lines as $refund_key => $refund_value) {
                  $refund = new WC_Order_Refund( $refund_value->refund_id );
                  if ( is_object( $refund ) && !wp_get_post_parent_id($refund->get_parent_id())) {
                      $child_orders_refund_lines[] = $refund_value;
                  }
              }
          }
      
          $report_data->partial_refunds = $report_data->refunded_orders = $child_orders_for_partial;
          $report_data->refund_lines  = $child_orders_refund_lines;   
      
          /**
           * Total up refunds. Note: when an order is fully refunded, a refund line will be added.
           */
          $report_data->total_tax_refunded          = 0;
          $report_data->total_shipping_refunded     = 0;
          $report_data->total_shipping_tax_refunded = 0;
          $report_data->total_refunds               = 0;
      
          foreach ( $report_data->refunded_orders as $key => $value ) {
             
              $report_data->total_tax_refunded          += floatval( $value->total_tax < 0 ? $value->total_tax * -1 : $value->total_tax );
              $report_data->total_refunds               += floatval( $value->total_refund );
              $report_data->total_shipping_tax_refunded += floatval( $value->total_shipping_tax < 0 ? $value->total_shipping_tax * -1 : $value->total_shipping_tax );
              $report_data->total_shipping_refunded     += floatval( $value->total_shipping < 0 ? $value->total_shipping * -1 : $value->total_shipping );
      
              // Only applies to parial.
              if ( isset( $value->order_item_count ) ) {
                  $report_data->refunded_order_items += floatval( $value->order_item_count < 0 ? $value->order_item_count * -1 : $value->order_item_count );
              }
          }
      
          // Totals from all orders - including those refunded. Subtract refunded amounts.
          $report_data->total_tax          = wc_format_decimal( array_sum( wp_list_pluck( $report_data->orders, 'total_tax' ) ) - $report_data->total_tax_refunded, 2 );
          $report_data->total_shipping     = wc_format_decimal( array_sum( wp_list_pluck( $report_data->orders, 'total_shipping' ) ) - $report_data->total_shipping_refunded, 2 );
          $report_data->total_shipping_tax = wc_format_decimal( array_sum( wp_list_pluck( $report_data->orders, 'total_shipping_tax' ) ) - $report_data->total_shipping_tax_refunded, 2 );
      
          // Total the refunds and sales amounts. Sales subract refunds. Note - total_sales also includes shipping costs.
          $report_data->total_sales = wc_format_decimal( array_sum( wp_list_pluck( $report_data->orders, 'total_sales' ) ) - $report_data->total_refunds, 2 );
          $report_data->net_sales   = wc_format_decimal( $report_data->total_sales - $report_data->total_shipping - max( 0, $report_data->total_tax ) - max( 0, $report_data->total_shipping_tax ), 2 );
      
          return $report_data;
      } );
      
      add_action( 'init', function() {
          global $WCMp;
          remove_filter( 'woocommerce_reports_get_order_report_data_args', array( $WCMp->report, 'woocommerce_reports_get_order_report_data_args' ), 99 );
      } );
      Copy
    • #113544
      print88
      Participant
    • #113591

      Hi,
      Can you please share your temporary admin and FTP access to your stagging site ( not live ) .So that we can debug on your site.

    • #113666
      abhirup
      Moderator
      This reply has been marked as private.
    • #113667
      print88
      Participant

      Please do not deactivate any plugins or touch the other network sites

    • #113678

      We have checked at our end and we found no issue. So to find the issue we have to debug your site for that we will need the FTP and admin access and during the course we might deactivate few plugin to detect the issue.
      Also, the admin access shared by you is not working. While sharing the access please mark the reply as private.

    • #114128
      print88
      Participant
      This reply has been marked as private.
    • #114204
      srutakirty
      Moderator

      Our team need to debug your site to find and fix the issue. Kindly share the stage FTP , admin and vendor access (staging site). While sharing the access, please mark the reply as private.

    • #114225
      print88
      Participant

      I can probably make a backup for you.
      But I am unable to create a staging site due to the hosting limitations.

    • #114254
      srutakirty
      Moderator

      Kindly share the URL of your site, FTP access and we will be debugging your site to fix the issue.
      Please share the access of the same site of which you have shared the admin access.
      Kindly take a backup of your site since we will be debugging your live site.

    • #114470
      print88
      Participant
      This reply has been marked as private.
    • #114471
      print88
      Participant
      This reply has been marked as private.
    • #114532

      The access shared by you is not working.

      Kindly share the URL of your site, FTP access, vendor, admin access and we will be debugging your site to fix the issue.
      Please share the access of the same site of which you have shared the admin, vendor access.

      Kindly take a backup of your site since we will be debugging your live site.

Viewing 16 reply threads

Please LOGIN to reply to this topic

Buy all Marketplace addons together, check out our Bundle

Buy at Slashed Price