Field Group values not saving on submit outside My Account area
Support › MB User Profile › Field Group values not saving on submit outside My Account area
- This topic has 1 reply, 2 voices, and was last updated 3 years, 1 month ago by
Long Nguyen.
-
AuthorPosts
-
March 20, 2022 at 10:59 PM #34683
Masterplan AcadeME
ParticipantHi
We use metabox to add custom fields to a users profile. The fields capture data on the users children (allergies, emergency contact, etc.) which we need when these children attend our extra-curricular programs. The group is cloneable so that parents can add multiple children.
Parents book through our website and are asked to assign a child to each activity booked on the final checkout page. We have custom plugin which handles this very well.
Parents are able to enter their child's details on their my account page (the woocommerce myaccount area with a custom endpoint). When editing / entering these field groups in the my account area, everything works fine. Data is saved, edits are saved and clones are saved.
The custom endpoint in the my account area is added through a small plugin, where we create the endpoint and display the following shortcode through php
[mb_user_profile_info id="child-details" submit_button="Submit" confirmation="Your information has been successfully submitted. Thank you."]
From a UX point of view however, users have complained that not being able to add a child and enter or update the child info as part of the checkout process is frustrating. We therefore embedded the form into the cart page by inserting the same shortcode as above into the cart page (through the page builder), thereby allowing the user to handle this data input / verification while they review their order in this step.
The field values display just fine (i.e. the details of any children added through the my account area). One if also able to clone the group and enter multiple childrens details into the forms. When one clicks on submit, the confirmation text is displayed, stating that the submission was successful.
But unfortunately none of the data is saved.
We thought we should perhaps be using another shortcode, the frontend-form maybe? We tried
[mb_frontend_form id="child-details"]
but then the fields don't show up?Any thoughts?
March 21, 2022 at 12:45 PM #35171Long Nguyen
ModeratorHi,
Can you please share the code that creates the field group
child-details
on your site? I've tested to add the user profile shortcode in the cart page, submit data and it saved as well.Code
add_action( 'woocommerce_before_cart_table', function() { echo do_shortcode( '[mb_user_profile_info id="user-meta" submit_button="Submit" confirmation="Your information has been successfully submitted. Thank you."]' ); } );
Screen record https://monosnap.com/file/xLSM0Yv05MCzJuDN7GB5nl2zf7MYxc
-
AuthorPosts
- You must be logged in to reply to this topic.