Skip Navigation

[Resolved] Adding variable woocommerce product to user registration form

This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 6 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1089368

I am trying to:

I am building a membership site and plan to use Toolset to create the member registration form because its so easy to use and style!

I have done the following:

- Created a variable subscription product in Woocommerce
- the product is TEST MEMBER and the variations are the levels of membership (8 different levels)
- I have properly added the CRED COMMERCE plugin

What I'm having trouble with:

I'm using the Auto-generate form option to create the User Registration form. as you know, this option does not grab all of the custom fields assigned to the form. So after auto-generating the form, then I manually add the product field to the bottom of the form, at the end of the form fields.

The problem is that after adding the product field (and after checking the box at the bottom of the form page to add a Woocommerce product), the form is not saving. I get sent to a 404 error page. But when I remove the product field, the form saves fine.

Link to a page where the issue can be seen:

there is no front-end link b/c I can't get the form to save.

I have run the debugger and have that info should you need it.

#1089567

Created a variable subscription product in Woocommerce
Forms Commerce is designed to work with simple virtual Products but not variable Products. The simplest approach here is to create different Products that correspond to each level of Membership.

I'm using the Auto-generate form option to create the User Registration form. as you know, this option does not grab all of the custom fields assigned to the form.
If you create a new User Form, any custom fields associated with User profiles will be added to the Form automatically when you use the auto-generate feature. If you add custom fields to User profiles after generating the Form code, you must manually add these new custom fields to the Form, or delete the Form code and re-generate the Form using the auto-generate button. Generic fields must always be added manually. I hope that helps.

The problem is that after adding the product field (and after checking the box at the bottom of the form page to add a Woocommerce product), the form is not saving. I get sent to a 404 error page.
How is this field added? I suspect it is because you're trying to integrate a variable Product or a non-virtual Product. As a test, switch the Product ID to a simple, virtual Product and try again. Here's the documentation that discusses setting up a radio button or select field that will allow your Users to select a Product to purchase:
https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/#2-1-product-to-buy
The general idea is you create a generic field and specify different options that correspond to different Product IDs. Here is an example:

[cred_generic_field field='prod-select' type='select' class='' urlparam='']
{
"required":0,
"validate_format":1,
"default":[],
"persist":1,
"options":[
{"value":"62","label":"Jacket"},
{"value":"65","label":"Sweater"}
]
}
[/cred_generic_field]

Please copy + paste the code for your Product field here.