Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. add_filter( 'woocommerce_add_cart_item_data', 'filter_add_cart_data', 10, 3
  2. );
  3. function filter_add_cart_data( $cart_item_data, $product_id){
  4.  
  5. if (isset($_POST['dropdown_color']))
  6. {
  7. $color = esc_attr($_POST['dropdown_color']);
  8. }
  9.  
  10. $cart_item_data['custom'] = array(
  11. 'color' => $color,
  12. 'unique_key' => md5(microtime().rand())
  13. );
  14.  
  15. return $cart_item_data;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement