0

We sell parts for vehicles which require the customer to select their vehicle, once selected the correct sku is shown to them and they can add it to their cart. We want the ability to save the vehicle selected to the line in the cart. This way when they are reviewing their order at checkout they can verify they selected the correct one. We would also like this information to be saved with the order so we can review in the case of a discrepancy.

I'm not sure what the best way to approach this is. I was thinking that adding a new attribute to these items would allow us to set the selected machine to the attribute but this won't work as it would update the item not the line item on the order. I also thought about setting up a line item comment area that could be populated with the selected machine but there does not seem to be a way in base Magento to enable line item comments. We could potentially save it out to the order comments, but this is not available at the time of selection as the customer has not checked out yet and therefore there is no order yet to update.

Does anybody have any suggestions on how best we can save out this value in a way that we will be able to display it in the cart and order?

1 Answer 1

0

I was able to get this working using the accepted answer from this post: How to "add to cart" a product with custom input field and save it to Database?

The gist of it is to add the value you wish to persist as an additional option to the quote line item, this is then carried through up until checkout. The additional attribute can then be copied to the order at the time of checkout.

The one issue with this process was that it preventing checking out when adding the additional attribute to configurable products due to Magento getting confused about the additional attribute when trying to find the simple product. To get around this I made a change to add the selected simple product to the cart with the additional attribute rather then adding the configurable.

I am now able to see the selected vehicle in the cart, checkout, and admin order pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.