Cart::maybe_delete_expired_products()
If product cache parameter is found, delete saved products from temporary cart.
Source
File: src/Tickets/Commerce/Cart.php
public function maybe_delete_expired_products() {
$delete = tribe_get_request_var( 'clear_product_cache', null );
if ( empty( $delete ) ) {
return;
}
$transient_key = $this->get_current_cart_transient();
// Bail if we have no data key.
if ( empty( $transient_key ) ) {
return;
}
$transient = get_transient( $transient_key );
// Bail if we have no data to delete.
if ( empty( $transient ) ) {
return;
}
// Bail if ET+ is not in place.
if ( ! class_exists( 'Tribe__Tickets_Plus__Meta__Storage' ) ) {
return;
}
$storage = new \Tribe__Tickets_Plus__Meta__Storage();
foreach ( $transient as $ticket_id => $data ) {
$storage->delete_cookie( $ticket_id );
}
}
Changelog
| Version | Description |
|---|---|
| 5.1.9 | Introduced. |