How can I do "Buy one get two free" with Ubercart?
I found the solution using Ubercart Custom Price module and the code below.

// Load the current shopping cart.
      $items = uc_cart_get_contents($cid = NULL, $action = NULL);


    // Count the number of items
      $number_of_items = count($items);

    $firstPrice = 10;
    $secondPrice = 0;
    $thirdPrice = 0;

    switch ($number_of_items) {
      case 0:
        $item-&gt;price = $firstPrice;
        break;

      case 1:
        $item-&gt;price = $secondPrice;
        break;

     case 2:
        $item-&gt;price = $thirdPrice;
        break;
    }