Tribe__Tickets_Plus__Meta::build_order_meta( array $product_ids, bool $include_empty = false )
Builds the meta data structure for storage in orders.
Contents
Parameters
- $product_ids
-
(array) (Required) Collection of Product IDs in an order.
- $include_empty
-
(bool) (Optional) Whether to include empty values.
Default value: false
Return
(array) The meta data for an order.
Source
File: src/Tribe/Meta.php
public function build_order_meta( $product_ids ) {
if ( ! $product_ids ) {
return array();
}
$meta_object = Tribe__Tickets_Plus__Main::instance()->meta();
$meta = array();
foreach ( $product_ids as $product_id ) {
$data = $meta_object->get_meta_cookie_data( $product_id );
if ( ! $data ) {
continue;
}
foreach ( $data as $id => $the_meta ) {
if ( ! isset( $meta[ $id ] ) ) {
$meta[ $id ] = array();
}
foreach ( $the_meta as $mid => $metadata ) {
$metadata = array_filter( $metadata );
$the_meta[ $mid ] = $metadata;
}
$meta[ $id ] = array_merge_recursive( $meta[ $id ], $the_meta );
}
}
if ( empty( $meta ) ) {
return array();
}
return $meta;
}
Changelog
| Version | Description |
|---|---|
| 4.1 | Introduced. |