1
Answers
Vote up!
0
Vote down!

How would I add a text field for custom text to an product?

I have a client who would like products with a input text field for custom text. (i.e. Slogan on a shirt or hat).

After crawling Google for a bit I came across a great video and it was exactly what I needed except I didn't have a section that was in the video. I believe the video is based on an older Kickstart.

I am using the latest Kickstart 2.

Here is the video I watched: http://commerceguys.com/blog/commerce-module-tuesday-commerce-customizab...

Here is the module they suggested: https://drupal.org/project/commerce_custom_product

Maybe this is no longer valid in Kickstart 2?

Any help would greatly be appreciated.

-Todd

Asked by: tkruger
on June 5, 2013

1 Answer

Vote up!
2
Vote down!

If I understand your question correctly, you don't actually want a text field on the product itself - you want every customer purchasing a particular product to be able to enter some custom text associated with their purchase. We facilitate this in Drupal Commerce through line item fields.

In the store configuration menu, you have access to all the line item types on your site and can add fields to them that are exposed to the customer on the Add to Cart form. Customers can then supply a text value that gets stored via the Field API on your line item, and you can edit your Views in the shopping cart / order interfaces to display the contents of that field.

Note that adding a field to the "Product" line item type will make that field visible on every Add to Cart form. If you only need this field on some products' Add to Cart forms but not all, then you can use the Commerce Customizable Products module to create additional product line item types and use different product display node types to generate Add to Cart forms using the different line item types.

I don't have time to write-up a full tutorial in this answer, but those steps outline the process. We have videos that are instructive but don't necessarily cover the exact material. Search the video library for our demonstration of using a line item field to allow custom donation amounts. It's conceptually similar and uses a line item field in the solution.

Ryan Szrama
Answer by: Ryan Szrama
Posted: Jun 6, 2013

Comments

Hi Ryan,

I've added a custom filed called 'Notes' in the line item product type. It is displayed on the product page as a text input field, so the user can add their notes for that product when they add this product into cart. It works very well.

But is it possible to let it editable in the shopping cart just like quantity field? So the user can change the notes before checking out. Currently in the cart it is not editable.

Thanks,
Tim

- timyao1977 on February 18, 2014