cart_update
Triggered on the modification of a shopping cart item’s properties.
Shop-Script
Input (passed by reference)
$old_item array Cart item properties before the modification as an array with the following keys:
$old_item['id'] int Item ID.
$old_item['product_id'] int product ID.
$old_item['sku_id'] int Product variant ID.
$old_item['quantity'] float Quantity in the shopping cart.
$old_item['contact_id'] int|null Customer contact ID, if logged in.
$old_item['create_datetime'] datetime Product creation date and time.
$old_item['code'] string Individual code.
$item array Cart item properties after the modification as an array with the same keys.
$update array Modified item properties as an array with the keys corresponding to the modified properties.
$old_item['id'] int Item ID.
$old_item['product_id'] int product ID.
$old_item['sku_id'] int Product variant ID.
$old_item['quantity'] float Quantity in the shopping cart.
$old_item['contact_id'] int|null Customer contact ID, if logged in.
$old_item['create_datetime'] datetime Product creation date and time.
$old_item['code'] string Individual code.
$item array Cart item properties after the modification as an array with the same keys.
$update array Modified item properties as an array with the keys corresponding to the modified properties.
… your plugin code …
Output
Shop-Script
Plugin code example
PHP
public function cartUpdate($params)
{
waLog::log(
sprintf_wp(
'What was changed about cart item with product_id/sku_id %d/%d:',
$params['item']['product_id'],
$params['item']['sku_id']
)
. PHP_EOL
. wa_dump_helper($params['update']),
'shop/plugins/' . $this->id . '/cart_update.log'
);
}









