I have a custom module that displays the Commerce receipt at the checkout complete screen. I have it all working except for the adjustments (tax, shipping, discounts) section.

In my custom module I have:

 $renderable = array(
      '#theme' => 'commerce_order_receipt',
      '#order_entity' => $order,
      '#billing_information' => NULL,
      '#shipping_information' => NULL,
      '#payment_method' => NULL,
      '#totals' => NULL,
      //'#totals' => $this->orderTotalSummary->buildTotals($order),
    if ($billing_profile = $order->getBillingProfile()) {
      $profile_view_bulder = \Drupal::entityTypeManager()->getViewBuilder('profile');
      $renderable['#billing_information'] = $profile_view_bulder->view($billing_profile, '');
    $renderable = NULL;

The commented line: ('#totals' => $this->orderTotalSummary->buildTotals($order), ) is what calls and generates the totals to pass to the receipt theme template but since it's in a custom module the "$this" part is not functioning.

The line was originally in commerce/modules/order/scr/Mail/OrderReceiptMail

Any tipes on how to get that method call to work in my module?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.