I am using Ubercart for our e-commerce on Drupal 8 website. Everything seems to be working fine except for the $order->getTotal() function - it does not somehow pickup the amount from my custom line items (for eg. 'shipping and handling') that I have added to the order.

It only seems to be going over the default 3 line items (subtotal, total, generic) that are provided by the uc_order module.

How can I achieve that? Thank you in advance.

1 Answer 1


I was able to achieve this by adding type as 'generic' for all my custom line items. Sample code:

uc_order_line_item_add($order->id(), 'generic', 'Promotion', -100, 6, NULL);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.