function uc_order_delete_line_item in Ubercart 8.4
Same name and namespace in other branches
- 5 uc_order/uc_order_line_item.inc \uc_order_delete_line_item()
- 6.2 uc_order/uc_order.line_item.inc \uc_order_delete_line_item()
- 7.3 uc_order/uc_order.line_item.inc \uc_order_delete_line_item()
Deletes a specific line item, or every line item in an order.
Parameters
int $id: The line item ID, or order ID.
bool $order: If FALSE, deletes the line item with the specified ID (default). If TRUE, deletes all line items on the order with the specified ID.
Return value
bool Always TRUE.
4 calls to uc_order_delete_line_item()
- CheckoutController::checkout in uc_cart/
src/ Controller/ CheckoutController.php - Builds the cart checkout page from available checkout pane plugins.
- LineItems::removeLineItem in uc_order/
src/ Plugin/ Ubercart/ OrderPane/ LineItems.php - Order pane submit callback: Remove a line item from an order.
- Order::postDelete in uc_order/
src/ Entity/ Order.php - Acts on deleted entities before the delete hook is invoked.
- uc_tax_uc_order_update in uc_tax/
uc_tax.module - Implements hook_uc_order_update().
File
- uc_order/
uc_order.line_item.inc, line 46 - Callbacks and helper functions for the default order line items.
Code
function uc_order_delete_line_item($id, $order = FALSE) {
$connection = \Drupal::database();
if ($order === FALSE) {
$connection
->delete('uc_order_line_items')
->condition('line_item_id', $id)
->execute();
}
else {
$connection
->delete('uc_order_line_items')
->condition('order_id', $id)
->execute();
}
return TRUE;
}