Skip to content

Commit 3bd543b

Browse files
authored
Merge pull request #2278 from themeum/gift_cart_fix
Fix: Gift course not rendering special characters correctly
2 parents f84e5b8 + 1cd17ec commit 3bd543b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

models/CartModel.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,21 @@ public function add_course_to_cart( $user_id, $course_id, $item_type = '', $item
7373
);
7474
}
7575

76+
if ( $item_details ) {
77+
if ( 'gift' === $item_type ) {
78+
$item_details = wp_json_encode( $item_details, JSON_UNESCAPED_UNICODE );
79+
} else {
80+
$item_details = wp_json_encode( $item_details );
81+
}
82+
}
83+
7684
return QueryHelper::insert(
7785
"{$wpdb->prefix}tutor_cart_items",
7886
array(
7987
'cart_id' => $user_cart_id,
8088
'course_id' => $course_id,
8189
'item_type' => $item_type,
82-
'item_details' => $item_details ? wp_json_encode( $item_details ) : null,
90+
'item_details' => $item_details,
8391
)
8492
);
8593
}
@@ -261,5 +269,4 @@ public function clear_user_cart( $user_id ) {
261269
)
262270
);
263271
}
264-
265272
}

0 commit comments

Comments
 (0)