Tribe__Tickets_Plus__Commerce__WooCommerce__Cart::remove_meta_for_ticket( string $cart_item_key, WC_Cart $cart )
Remove meta for ticket when removed from the cart.
Contents
Parameters
- $cart_item_key
-
(string) (Required) The cart item ID.
- $cart
-
(WC_Cart) (Required) The WooCommerce cart class.
Source
File: src/Tribe/Commerce/WooCommerce/Cart.php
public function remove_meta_for_ticket( $cart_item_key, $cart ) {
/** @var \Tribe__Tickets_Plus__Meta $tickets_meta */
$tickets_meta = tribe( 'tickets-plus.main' )->meta();
$product_id = $cart->cart_contents[ $cart_item_key ]['product_id'];
$ticket_has_meta = $tickets_meta->ticket_has_meta( $product_id );
if ( ! $ticket_has_meta ) {
return;
}
// Go to meta storage and remove any meta for that ticket it.
$storage = new Tribe__Tickets_Plus__Meta__Storage;
$storage->delete_meta_data_for( $product_id );
}
Changelog
| Version | Description |
|---|---|
| 4.11.0 | Introduced. |