LemonStand Documentation

shop:onPreProcessProductCustomData event

The shop:onPreProcessProductCustomData event is triggered before product is placed to the cart and before the shop:onBeforeAddToCart event is triggered. The event allows you to modify custom product parameters before product is added to the cart. Please read this article to learn about customizing products on the Product Details page. The event handler function should accept the following parameters:

  • Cart name
  • Product object (Shop_Product)
  • Quantity
  • Product options array
  • Product extra options array
  • Product custom data fields array

 The handler should return an array of modified parameters. 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)
{
  $result = array();
  if (!isset($custom_data['x_engraving_text']))
    $result['x_engraving_text'] = 'Yahoo!';
 
  return $result;
}

Next: shop:onDisplayCustomersPage event
Previous: shop:onGetOrderItemDisplayDetails event
Return to Handling LemonStand events