You are here

public function LineItems::removeLineItem in Ubercart 8.4

Order pane submit callback: Remove a line item from an order.

File

uc_order/src/Plugin/Ubercart/OrderPane/LineItems.php, line 190

Class

LineItems
View and modify an order's line items.

Namespace

Drupal\uc_order\Plugin\Ubercart\OrderPane

Code

public function removeLineItem($form, FormStateInterface $form_state) {
  $order =& $form_state
    ->get('order');
  $triggering_element = $form_state
    ->getTriggeringElement();
  $line_item_id = intval($triggering_element['#return_value']);
  uc_order_delete_line_item($line_item_id);
  $order->line_items = $order
    ->getLineItems();
  $form_state
    ->setRebuild();
}