Add custom field with product in woocommerce cart

I’m trying to insert my own custom value in the $values array, but I don’t know how?

I think I need to edit class-wc-cart.php, but how?

Read More
$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,
  'quantity' => $quantity,
  'dealer-name'   => 'bindiya',  //ex. dealer name
  'data'    => $product_data
) ), $cart_item_key );

I want to add dealer name of product associate with this particular product in array while user press add to cart button.

And later on i have to display this all products dealer name associated with it in admin side order listing.

Can someone help me?

Thank in advance.

Related posts

Leave a Reply