As a follow-up to #1211278: Allow commerce_cart_add_to_cart_form() to edit line items which applies to attribute fields (attached to product types), I'm assuming it would also be possible to use commerce_cart_add_to_cart_form() as an edit form for existing cart line items where line item fields (attached to line item types) are used.
For example, this would allow a customer to be able to update the custom text he/she wants printed on a product directly in the cart as is suggested here #1033050: Support customizable products via the Add to Cart form.
Note that in this particular use case the custom text field is added to a line item type, e.g. Product or a custom one.
Comment | File | Size | Author |
---|---|---|---|
line_item_field_widget.png | 52.02 KB | bisonbleu |
Comments
Comment #2
bisonbleu CreditAttribution: bisonbleu commentedHum... I'm realizing that the logic of 1211278 cannot be used as a canvas for solving the current issue because editing/changing an attribute is like selecting a different product.
In the current issue, we're not changing the product, we're simply updating the value of line item field.
Comment #3
bisonbleu CreditAttribution: bisonbleu commentedUpdate: editablefields.module offers a partial solution* as long as re-calculating the sell price of the product is not required. In other words, changing the value of the custom text in the cart does not automatically update the cart.
So in a use case where each character of the custom text cost 5¢, changing the custom text will not automatically change the price. One has to click Update cart to see the new price.
If this sounds like an edge case, then consider a rental period select field with options 1 day, 3 days, 1 week for a store which rents products. Clearly the price needs to be re-calculated when the value of that field changes.
Assuming the above is relatively easy to fix, it leaves one question: is editablefields the way to move forward with this kind of scenario? Looking at the project page is not exactly reassuring.
* To allow anonymous users to change editable fields, a patch is required. See #1344634: Editing fields without update access (D7)