I'm writing a custom script for woocommerce. Essentially it allows a user to customize a product with several choices, then add the finished product to their cart. I'm having issues figuring out how to add the finished product to the cart.
I've created a several products (2 bases, 6 customizations), and the user must:
- first select a base
- then select which customizations they want to add to the base product
I'd like to add the base product to the cart, with the customizations, and was hoping there was a way to insert an additional field in the base, which is populated by the php script when the base is added to the cart.
So, user picks base A, with customizations x,y,z. All of this information is stored in the $_SESSION variable
User confirms the customization before placing it in the cart
User adds to cart, php script adds base to cart, and adds a note somewhere identifying the customizations.
When user views their cart, they only see the base product, and a note about the customization, rather than seeing 4 products (base plus three customizations) in their cart.
What do I need to do to add a custom note or field to a product, and be able to populate it with dynamic content when the product is added to the cart?