Drupal commerce - Add to cart anonymously, programmatically


Feature: add an item to the shopping cart of every visitor so they can checkout immediately.

Actually a shopping cart can belongs to anonymous, linked by session ID
Commerce kickstart had already demonstrate such behaviour.

But the problem is,

<?php
 commerce_order_new
(0);
?>
do not actually link the cart with anonymous session

All you need is :

<?php
 commerce_cart_order_session_save
($order->order_id);
?>
AttachmentSize
Image icon download.png11.64 KB
Google