This is the API docs for LemonStand V1, which has been discontinued. LemonStand is now a cloud based platform, available at lemonstand.com.

LemonStand API

shop:onGetProductPriceNoTax event

Triggered by Shop_Product
Author LemonStand eCommerce Inc.

Event handler signature

public array event_onGetProductPriceNoTax(array $params)
$params array an array of parameters.
{return} array returns an array with price element.
Allows to override product's base price. The event handler should accept a single parameter, an array containing the following elements: Example:
  • price - the calculated product price.
  • product - a Shop_Product object, a product the price is being calculated for.
  • quantity - number of products to calculate the price for (if tier pricing is used).
  • customer_group_id - identifier of a customer group the price is being calculated for.
The event handler should return an array with the price element. Example:
public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onGetProductPriceNoTax', $this, 'fix_price');
}

public function fix_price($data)
{
  //increase price by 10% for customers from a specific customer group
  if($data['customer_group_id'] == 1)
  {
    $data['price'] = $data['price'] * 1.1;
    return $data;
  }

  //return set price for specific product
  if($data['product']->sku == 'testproduct')
  {
    $data['price'] = 200;
    return $data;
  }

  //increase the discount with quantity of the product
  if($data['quantity'] > 1)
  {
    if($data['quantity'] >= 5)
      $discount = 0.5;
    else
      $discount = $data['quantity'] * 0.1;

    $data['price'] = $data['price'] * (1 - $discount);
    return $data;
  }
}