Description
The “tcp_shopping_cart_key” filter is used to filter the key of a new product ()or modifying or deleting) in the Shopping Cart. Change this key would be useful for customised products. So the same product could be in the shopping cart more than once, but with different customised properties.
Example
<?php function my_tcp_shopping_cart_key( $key ) { $custom_one = isset( $_REQUEST['property_one'] ) ? $_REQUEST['property_one'] : false; $custom_two = isset( $_REQUEST['property_two'] ) ? $_REQUEST['property_two'] : false; if ( $custom_one or $custom_two ) return $key . ‘_’ . $custom_one . ‘_’ . $custom_two; return $key; } add_filter( ‘tcp_shopping_cart_key’, ‘my_tcp_shopping_cart_key’ );?>
Change Log
Since 1.2.0