Pergunta

I don't know if there are any Ubercart guru's out here, but here's my question:

I'd like to give discounts to customers who order more then 1 of the same product.

Lets say the prices are as follows:

1 product - $5 each
< 10 products - $4.50 each
< 100 products - $4 each

Anyone knows how to realise this? I thought of adding my own custom price fields but i wonder how to call on them in the cart /checkout.

Foi útil?

Solução

How about the uc_bulk_discount module?

Outras dicas

I'm no guru, but some googling pointed me to hook_uc_price_handler.

You can set up a handler to deal with the price.

If you had a custom module called 'example' you could do the following;

function example_uc_price_handler() {
  return array(
    'alter' => array(
      'title' => t('Quantity price discount handler'),
      'description' => t('Discounts the price based on quantity ordered'),
      'callback' => 'example_price_alterer',
    ),
  );
}

function example_price_alterer(&$price_info, $context, $options = array()){

    if($price_info['qty'] > 200){
        $price_info['price'] *= 0.8;  //we're reducing the price by 20% as a demo - add your logic here 
    }

}

Here are my sources;

http://www.ubercart.org/docs/developer/11375/price_api http://www.ubercart.org/forum/development/14381/price_alteration_hook http://api.ubercart.org/api/function/hook_uc_price_handler/2

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top