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:onPreProcessProductCustomData event

Triggered by Shop_Cart
Author LemonStand eCommerce Inc.

Event handler signature

public array event_onPreProcessProductCustomData(string $cart_name, Shop_Product $product, integer $quantity, array $options, array $extra_options, array $bundle_data, array $master_bundle_data, $master_bundle_data)
$cart_name string specifies the cart name.
$product Shop_Product specifies the product object.
$quantity integer specifies the cart item quantity.
$options array an array of product options.
$extra_options array an array of product extra options.
$bundle_data array bundle data associated with the product.
$master_bundle_data array master bundle data associated with the product.
$master_bundle_data
{return} array the handler should return an associative array of modified custom fields.
The event allows you to modify custom (API) product parameters before product is added to the cart. The event is triggered before product is placed to the cart and before the shop:onBeforeAddToCart event is triggered. Please read this article to learn about customizing products on the Product Details page. Usage example:
public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onPreProcessProductCustomData', $this, 'preprocess_custom_data');
}

public function preprocess_custom_data($cart_name, $product, $quantity, $options, $extra_options, $custom_data, $bundle_data, $master_bundle_data)
{
  $result = array();
  if (!isset($custom_data['x_engraving_text']))
    $result['x_engraving_text'] = 'Yahoo!';

  return $result;
}