Skip Navigation

[Closed] User form integration with a Woocommerce product?

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by Minesh 1 year, 9 months ago.

Assisted by: Minesh.

Author
Posts
#2537495

I am trying to place a Toolset User Form on a Woocommerce product page in a way where the form Submit button would replace the Woocommerce Add to Cart button in that a submission will simultaneously submit the form AND add the product to the cart.

I actually have two issues here.

1) Need to make the form Submit button double as the Add to Cart form.

and

2) The Membership Type field that I have present in the form seems to be needed to trigger the conditional display of four additional fields on the form when the Family Membership Type option is selected. But this Membership Type is also a product attribute and displays again above the Add to Cart button. Is there any way to trigger the Toolset form conditional based on this Attribute selection instead of having a separate Membership Type field?

Or is this level of integration impossible and I need to separate the form from the product purchase? I know you have the ability to add payment to a Toolset form submission. I'm not sure if that will work for our needs here. We have purchased the Paid Memberships Pro plugin and have the user membership system tied to the purchase of this Woocommerce product. We just like your User Form features better that what we previously set up here because of the ability to then build Views to display our users with all the custom field data.

If we have to set up the User Form on a regular WordPress page and then upon submission of the form, have that lead the user to the product page to purchase it, we could do it that way, but a one step process would be preferred. If we do have to do it that way, I would have the question of if the User Form is submitted, would we also have to add another step of getting them to log in before purchasing the Woocommerce product? Or would the User Form submission log them in with their provided information to allow them to go directly to the Woocommerce product to purchase the membership?

Any suggestions for this would be appreciated. To summarize what we'd ideally have on one product page with only one button needed for submission:

1) Toolset User Form
2) Woocommerce Product
3) Paid Memberships Pro Membership tied to product purchase.

You can see what we have so far here:

hidden link

#2537939

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

There is no way to combine all those entities in one form and even if you may found a way to combine it sooner or later there will be a great possibility that it will not be stable solution and broken.

Lets break your requirement in smaller tasks first.
Regarding user registration form:
I suggest you should go with the path with creating user registration form. What if user fills the required details with the registration form and when user submits it the user will be automatically logged-in. is that sounds good?

#2538899

I have the user registration form on the product page right now, but I can easily pull it off of that and make a new page just for this form. If the submission of that form will automatically log the person in using the credentials they provided, that would be fine. We could then have them redirected to the product page after the submission of the form and they'll complete the process there. It would be a two-step process where we'd prefer to get a one-step process, but with the automatic log in it wouldn't be a three-step process.

So how do I set up the user form to automatically log in the user upon submission?

#2539681

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You can use the Toolset form hook "cred_submit_complete" or "cred_save_data" whichever hook suit to auto-login the user.

Here is the reference ticket and you can adjust the Form ID and other code as required:
=> https://toolset.com/forums/topic/correct-redirect-doesnt-work-after-auto-login-using-cred-user-creation/#post-2355335

Here is the more related ticket:
- https://toolset.com/forums/topic/automatically-log-in-user-after-registration/#post-629044

#2540171

Question about the code you provided in the first link above before I try to apply it on our site. On that reply, you said " I checked and after registration it successfully redirect me to profile update page.". Can you provide code that would NOT redirect to the profile page, but still have the person logged in with the credentials they provided in the form. We're likely going to have this form redirect to a product page where they will complete the purchase of their membership. So if a successful login takes them to their profile page, they won't be able to purchase the membership from there.

We need to make sure the user is logged in with the credentials provided in the form after submitting it because otherwise their store purchase in Woocommerce of the membership product will assign them another user account.

#2540335

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You can set the redirection from your form settings.

You should edit your form and from the "Settings" section, check the setting "After visitors submit this form" dropdown and select the Go to a page or set the option that fulfils your requirement.

Do you have a specific page/post to redirect user after login?

#2541411

OK, I was thinking the redirect came from your custom code in some way. I can easily set the redirect in my form settings as you indicated.

Yes, we're going to send people to a specific Woocommerce product after login.

I've added the code from your first link as a custom code snippet in Toolset settings. Before I activate it, I want to make sure I have it correct that I only needed to change the following lines of code:

In the code you supplied
// User Form - New Family 1308
// User Form - New Native Nanny 1242
$forms = array( 1308, 1242);

Changed to the following for our needs

// User Form - Membership Form 4264
$forms = array( 4264);

I'm not sure if that's correct as it may need to be changed further to only work on the single form. We only have the single role assignment but that's set up to be added through the product purchase, so it's not needed at this point in the process.

#2541689

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - thats correct. If you face any issues you are welcome to get back to me and share problem URL where you added your form as well as admin access details.

I have set the next reply to private which means only you and I have access to it.

The topic ‘[Closed] User form integration with a Woocommerce product?’ is closed to new replies.