Skip to content

Instantly share code, notes, and snippets.

@init90
Last active February 6, 2019 22:13
Show Gist options
  • Save init90/9a91adcad4fe868ec114f97d5b0baed0 to your computer and use it in GitHub Desktop.
Save init90/9a91adcad4fe868ec114f97d5b0baed0 to your computer and use it in GitHub Desktop.
Drupal 7, commerce. Get all order ids from anonymous users which have cart status.
$status_ids = array_keys(commerce_order_statuses(array('cart' => TRUE)));
$cart_order_ids = db_query('SELECT order_id FROM {commerce_order} WHERE uid = 0 AND status IN (:status_ids)', array(
':status_ids' => $status_ids,
))->fetchCol();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment