Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Events/OrderPlaced.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function hellotext_order_placed(\WC_Order $order): void {
? sanitize_text_field($_COOKIE[Constants::SESSION_COOKIE_NAME])
: null;
$encrypted_session = Session::encrypt($session);
add_post_meta($order->get_id(), Constants::META_SESSION, $encrypted_session);
$order->update_meta_data(Constants::META_SESSION, $encrypted_session);
$order->save();

$event->track(Constants::EVENT_ORDER_PLACED, [
'object_parameters' => $parsedOrder,
Expand Down
2 changes: 1 addition & 1 deletion src/Events/OrderStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @return void
*/
function track_order_status(int $order_id, string $old_status, string $new_status, \WC_Order $order): void {
$encrypted_session = get_post_meta($order_id, Constants::META_SESSION, true);
$encrypted_session = $order->get_meta(Constants::META_SESSION, true);
$session = Session::decrypt($encrypted_session);

$orderAdapter = new OrderAdapter($order);
Expand Down
2 changes: 1 addition & 1 deletion src/Events/RefundReceived.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function hellotext_refund_created(int $order_id, int $refund_id): void {

do_action('hellotext_create_profile', $order->get_user_id());

$encrypted_session = get_post_meta($order_id, Constants::META_SESSION, true);
$encrypted_session = $order->get_meta(Constants::META_SESSION, true);
$session = Session::decrypt($encrypted_session);

(new Event($session))->track(Constants::EVENT_REFUND_RECEIVED, [
Expand Down
Loading