Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'woocommerce_add_cart_item_data', 'filter_add_cart_data', 10, 3
- );
- function filter_add_cart_data( $cart_item_data, $product_id){
- if (isset($_POST['dropdown_color']))
- {
- $color = esc_attr($_POST['dropdown_color']);
- }
- $cart_item_data['custom'] = array(
- 'color' => $color,
- 'unique_key' => md5(microtime().rand())
- );
- return $cart_item_data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement