woocommerce_add_to_cart filter
This commit is contained in:
parent
4182a35ed5
commit
b18c7e5ec3
|
@ -679,8 +679,10 @@ class WC_Cart {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
$cart_item_key = $cart_id;
|
||||||
|
|
||||||
// Add item after merging with $cart_item_data - hook to allow plugins to modify cart item
|
// 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,
|
'product_id' => $product_id,
|
||||||
'variation_id' => $variation_id,
|
'variation_id' => $variation_id,
|
||||||
'variation' => $variation,
|
'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 );
|
$woocommerce->cart_has_contents_cookie( true );
|
||||||
|
|
||||||
$this->set_session();
|
$this->set_session();
|
||||||
|
|
Loading…
Reference in New Issue