Tribe__Tickets_Plus__Commerce__EDD__Meta::save_attendee_meta_to_order( int $order_id, array $post_data )
Sets attendee data on order posts
Contents
Parameters
- $order_id
-
(int) (Required) EDD Order ID
- $post_data
-
(array) (Required) Data submitted via POST during checkout
Source
File: src/Tribe/Commerce/EDD/Meta.php
public function save_attendee_meta_to_order( $order_id, $post_data ) {
$order_items = edd_get_payment_meta_cart_details( $order_id );
// Bail if the order is empty
if ( empty( $order_items ) ) {
return;
}
$product_ids = array();
// gather product ids
foreach ( (array) $order_items as $item ) {
if ( empty( $item['id'] ) ) {
continue;
}
$product_ids[] = $item['id'];
}
$meta_object = Tribe__Tickets_Plus__Main::instance()->meta();
// build the custom meta data that will be stored in the order meta
if ( ! $order_meta = $meta_object->build_order_meta( $product_ids ) ) {
return;
}
// store the custom meta on the order
update_post_meta( $order_id, Tribe__Tickets_Plus__Meta::META_KEY, $order_meta, true );
// clear out product custom meta data cookies
foreach ( $product_ids as $product_id ) {
$meta_object->clear_meta_cookie_data( $product_id );
}
}
Changelog
| Version | Description |
|---|---|
| 4.1 | Introduced. |