Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It does not seem to be possible presently to have a customer be able to enter custom text to go on a product, like a custom message for a shirt/mug/card/etc. I can add a text field to a product, but that seems only to be defined at the time of the product's creation, and is never "exposed" to the customer for editing as they are adding it to their cart.
Ubercart supported this and it was a very useful bit of functionality.
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedThe problem here is that in Drupal Commerce, the Add to Cart form adds a specific product from the back end to the cart via a product line item. Therefore, you can't customize random attributes and associate them with the product in the cart. However, it does seem likely we could include some way for line item fields to show up in the Add to Cart form... this would lead to us needing to support multiple product line item types, though, and I'm not sure if we want to go there or not. It might mean we just need some sort of sub-entity that gets attached to a line item, using some model like the Micro module is exploring.
For 1.0, though, customizable products will remain off the roadmap. I'll make sure to add this feature to the potential list of 2.0 features to pursue. It's something we've thought about, we just haven't written any proposals / issues for the features yet.
Comment #2
arcadian83 CreditAttribution: arcadian83 commentedThanks for your reply. I was not aware of Micro, and will look into it. :)
Comment #3
arcadian83 CreditAttribution: arcadian83 commentedAfter a little playing around with Micro and Drupal Commerce, I'd say that Micro has some maturing to do (still in 1.x-dev), and Drupal Commerce currently does not integrate with it.
(Just so people reading this don't get the idea that it's currently a viable solution based on my last post.)
Comment #4
mikejoconnor CreditAttribution: mikejoconnor commentedCould this be handled via contrib already ?
I.e. it seems like a contrib module could create a custom add to cart widget, which would allow a user to customize the current product, either via a on the fly, check box based product kit. or possibly via on the fly product creation (add a name for engraving).
Either way, it almost seems like this could be done already, in the contrib space, but I could be wrong.
Comment #5
hunziker CreditAttribution: hunziker commentedI create a new project. This project tries to accomplish this feature. You can find it here:
Commerce Option
At the moment you need to apply the patch contained in the module repository. I have add an issue to bring this change into the core of commerce.
Comment #6
rszrama CreditAttribution: rszrama commented(Just a note to say I committed hunziker's patch.)
Comment #7
Summit CreditAttribution: Summit commentedHi, link to Commerce Option is "page not found". Where is this module please?
greetings,
Martijn
Comment #8
rszrama CreditAttribution: rszrama commentedIt's been updated to a full project: http://drupal.org/project/commerce_option
Also, I should add that I just put support for including line item fields on the Add to Cart form. I forgot this issue existed, but I hadn't pushed yet... so I'll update my commit message to point here and outline the new code / changes I'm working on right now:
When that's all done (this evening), I'll consider this issue fixed. : )
Comment #9
rszrama CreditAttribution: rszrama commentedJust committed item 2 above: http://drupalcode.org/project/commerce.git/commitdiff/18299bc
Comment #10
Damien Tournoud CreditAttribution: Damien Tournoud commentedShaping up (4):
4a. Before calling the add to cart form, the formatter will have to check if there is a "combinable" line item. If there is, it should load it and pass it to the add to cart form
4b. As a consequence, the combination logic currently in commerce_cart_product_add() needs to be abstracted into an API function
4c. The same option of the add to cart formatter mentioned in 2b needs to control whether or not we do 4a in the first place
This will also solve the long standing issue that the quantity field is always 1 regardless if you already have the product in your cart or not. Sweet.
Comment #11
rszrama CreditAttribution: rszrama commentedCommitted http://drupalcode.org/project/commerce.git/commitdiff/27beea5 to fix item 3. Specifically I had to add a new filter to support multiple product line item types in our various Cart Views, add support and documentation for the 'product' property of line item types, and add API functions / make API adjustments to support multiple line item types. This commit also fixes some failing tests b/c the Base test class wasn't updated for the new parameters of commerce_cart_product_add() when I made the commit for item 1.
Comment #12
rszrama CreditAttribution: rszrama commentedJust committed the follow-up to add options to the display formatter settings supporting selecting from available product line item types. I also changed the line item configuration callback to receive the $line_item_type array as a parameter. This means if you want to quickly create a new product line item type, you just have to set its 'base' => 'commerce_product_line_item' to reuse all the standard product line item type callbacks.
Commit: http://drupalcode.org/project/commerce.git/commitdiff/7355dcc
Comment #13
rszrama CreditAttribution: rszrama commentedAs an RC blocker, I think the necessary work has been completed. I've opened a follow-up issue to address item #4 as it will require no change other than to the form submit handler and display formatter.
See: #1211278: Allow commerce_cart_add_to_cart_form() to edit line items