I am using Drupal commerce. For particular reasons, I found it necessary to programatically add items to the cart one the review page. The problem is: when I do this, I get redirected back to the checkout page, which I don’t want. Here is my code:
foreach($registrants as $key=>$registrant) { //for each additional registrant in the event order object if($key == 0 && $memberStatus == "Member") { //the first additional registrant gets the member price free, if the applicant is a member //$line_item = commerce_product_line_item_new($product, $quantity); //$line_item = commerce_cart_product_add($event->product_id, $line_item, TRUE); commerce_cart_product_add_by_id($memberGuestId); $order = commerce_order_status_update($order, 'checkout_review', FALSE, TRUE, t('Additional registrants have been added to the cart')); drupal_goto('checkout/' . $order->order_id . '/review'); } else { commerce_cart_product_add_by_id($nonMemberGuestId); $order = commerce_order_status_update($order, 'checkout_review', FALSE, TRUE, t('Additional registrants have been added to the cart')); drupal_goto('checkout/' . $order->order_id . '/review'); } }
I even tried forcing it back to the review page with a goto, and no luck. What is happening here?
Sponsored by SupremePR