woocommerce_add_to_cart filter

This commit is contained in:
Mike Jolley 2012-04-03 15:37:04 +01:00
parent 4182a35ed5
commit b18c7e5ec3
1 changed files with 5 additions and 1 deletions

View File

@ -679,8 +679,10 @@ class WC_Cart {
} else {
$cart_item_key = $cart_id;
// Add item after merging with $cart_item_data - hook to allow plugins to modify cart item
$this->cart_contents[$cart_id] = apply_filters( 'woocommerce_add_cart_item', array_merge( $cart_item_data, array(
$this->cart_contents[$cart_item_key] = apply_filters( 'woocommerce_add_cart_item', array_merge( $cart_item_data, array(
'product_id' => $product_id,
'variation_id' => $variation_id,
'variation' => $variation,
@ -690,6 +692,8 @@ class WC_Cart {
}
do_action( 'woocommerce_add_to_cart', $product_id, $cart_item_key );
$woocommerce->cart_has_contents_cookie( true );
$this->set_session();