WooCommerce: Add input field to every item in cart

前端 未结 3 523
灰色年华
灰色年华 2020-11-29 02:17

I\'ve been trying to add a single text input field to every item in the cart and submit that user input to product\'s meta info. It\'s been 2 days and I haven\'t succeeded y

3条回答
  •  遥遥无期
    2020-11-29 02:49

    You can do this fairly easily with the Woocommerce Product Add-ons plugin

    From the WooThemes website:

    Allow your customers to customise your products by adding new options such as input boxes, dropdowns or checkboxes. With the Product Add-ons extension, gift messages, donations, laser engraving and any other product which may require user input in some way is now an option for your customers!

    Product add-ons supports required fields, textareas, checkboxes, radios, select boxes, custom price inputs and file upload boxes.

    I've used it before to add an additional donation field to a product purchase and display that on the thank you page/receipt email.

    It's about $50 US and will get you up and running in no time to add the text input and display the field on thank you page/email like you want. $50 is definitely worth the amount of time you'd save drying to develop this feature yourself.

    Here's the flow from the end-users perspective:

    End user enters in field data and adds product to cart End User enters in field data and adds product to cart

    When User views cart the data they entered into the custom field displays along with the product When User views cart the data they entered into the custom field displays along with the product

    After purchase, end user lands on thank you page and receives receipt email with field data included with the product item. After purchase, end user lands on thank you page and receives receipt email with field data included with the product item.

    On the backend:

    Create custom field for each product. The option is located on the Add-Ons menu tab.

    1. Create a new Addon Group
    2. Enter a group name (for easier organization)
    3. Add a new option and enter the label (this is what the end user sees and is tied to the product)
    4. Update/Publish product.

    Create custom field for each product

    For completed orders, this is what you will see in the Order Details admin:

    product order details page also displays the field

    Hope this helps and saves you a ton of time in development!

提交回复
热议问题