Tribe__Tickets_Plus__Meta__Storage::get_meta_data( null|int $id = null, null|string $hash_key = null )
Get saved meta from transient.
Contents
Parameters
- $id
-
(null|int) (Optional) Post ID (or null if using current post). Note: This is only for context, it does not affect what is returned.
Default value: null
- $hash_key
-
(null|string) (Optional) The hash key.
Default value: null
Return
(array) Saved meta from transient.
Source
File: src/Tribe/Meta/Storage.php
public function get_meta_data( $id = null ) {
// determine transient id from cookie or WooCommerce session
$transient_id = '';
if ( isset( $_COOKIE[ self::HASH_COOKIE_KEY ] ) ) {
$transient_id = $_COOKIE[ self::HASH_COOKIE_KEY ];
}
if ( ! $transient_id && 'product' === get_post_type( $id ) && ! is_admin() ) {
$wc_session = WC()->session;
if ( empty( $wc_session ) ) {
return array();
}
$transient_id = $wc_session->get( self::HASH_COOKIE_KEY );
}
if ( ! $transient_id ) {
return array();
}
$transient = self::TRANSIENT_PREFIX . $transient_id;
return get_transient( $transient );
}