Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

woocommerce add custom field to product when adding to cart WordPress



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?


Answers (1)


Arnav Joy answers:

can you show your site so and let me know the steps to see what are you saying in above description ?

need_some_help comments:

@arnav Joy, I sent you a private message with the URL