For example the firs item is $3 and the second one & the third one are $0. Can I do this? Maybe Ubercart Discounts (Alternative) can do the result but I don't want to show the discount price and just want to show the second and the third item $0 on the cart page.

  • Check out buy one get one free Ubercart discount module?
    – Chapabu
    Commented Feb 23, 2012 at 10:36
  • The OP is asking for an alternative to the Ubercart Discounts (Alternative) module, which is the only solution reported in the other question. Alternatively, if that is the only module available, the OP is interested to show the result in a different way (e.g. without show the discount price).
    – apaderno
    Commented Feb 23, 2012 at 15:28
  • The problem using "Ubercart Discounts (Alternative)" is that in the cart pane I don't want to show the price of the discounted item but just simply as "$0" for the secound and the third item. Also I don't want to show the "sub total" or "Total discount" but only the final amount after discounted.Basically what want to do is simply make the second and the third products free for this product type without charging once and then discounting.
    – chinita7
    Commented Feb 24, 2012 at 19:16

1 Answer 1


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->price = $firstPrice;

      case 1:
        $item->price = $secondPrice;

     case 2:
        $item->price = $thirdPrice;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.