문제

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.

도움이 되었습니까?

해결책

How about the uc_bulk_discount module?

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top