I am using WooCommerce Subscriptions on a site and would like for a user to be able to select a subscription using a cred form together with cred commerce.
I followed this tutorial https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/ but somehow the form just stays completely empty.
First I thought its because I am using subscriptions instead of normal products so I created a normal product but still the same issue persists.
Not really sure what I am missing here, I tried all kinds of settings (add/edit content etc) in the form itself but the form remains empty.
Any ideas would be much appreciated.
Thanks in advance 🙂
Please share a screenshot of your CRED Commerce form settings, like the one I have posted here. Next, make sure the product selected is active, in stock, and has a set price. I would also check the JavaScript console to see if any errors are displayed. Please let me know the results of these tests.
The product does have everything set up and the console doesn't throw any errors. I have attached the screenshot you asked for and another one showing the complete form settings.
What I find weird is that in the frontend the form looks like a totally normal cred form to add content so basically for me to create a product using that form which leads me to believe that I have missed something somewhere to make this a "true" cred commerce form if that even makes sense 😉
What I find weird is that in the frontend the form looks like a totally normal cred form to add content so basically for me to create a product using that form
Right, because this is what your CRED form is set up to do. The CRED Commerce form is connected to the post type "Produkte" in the screenshot you have posted, so the generated form will allow the user to create a "Produkte" post. All the necessary inputs to define a Produkte will be available. Perhaps this was not your intention?
If you do not want the user to create a Produkte post, you should associate this form with a different post type in "Post type connected to this form". You can create a custom post type specific for this process, if the post being created is not important. Then regenerate the form to update the inputs. If the contents of this post are not important, then you can remove all the [cred_field] tags from the CRED form editor except the "form_submit" tag. This will just show a button your user can click, which will submit the form. CRED Commerce will automatically create a post in this post type, and add the linked Produkte "test produkt" to the user's shopping cart.
"Produkte" is the woo product posttype and since it doesnt let me save the form without selecting a post type I thought that would be the most appropriate 😉
I removed all the fields except the form_submit and yes once I click it, the product is being added to the cart. How would I go about variable products though? Any way I can have the variations dropdown in the form?
And one more thing for clarity (let me know if I should open a new ticket for this)
The overall goal is to:
have a logged in user click one of his custom cpts and in there, have the form. Once he submits the form and checks out etc, it should show the name (and maybe more information) of the product in that cpt, is that somehow possible using cred save data hook or something?
How would I go about variable products though? Any way I can have the variations dropdown in the form?
CRED Commerce can only add Simple Products. If you want to modify the cart contents after CRED Commerce adds them, we have the CRED Commerce API documented over here with several hooks you might find useful:
https://toolset.com/documentation/programmer-reference/cred-commerce-api/
have a logged in user click one of his custom cpts and in there, have the form. Once he submits the form and checks out etc, it should show the name (and maybe more information) of the product in that cpt, is that somehow possible using cred save data hook or something?
Yes, the general idea is that in the cred_save_data hook, you will capture the ID of the product that was selected by the user. Then you can save that ID to the CPT as a custom field or a series of custom fields, depending on how you want this to work. In the Content Template for this CPT you can then loop over those custom fields and display information about the related products. If you'd like more detailed information about that, please file a separate ticket.
I think its gonna be easier to just use two forms then and convert the variable product into two normal ones since there are only two variations.
Is there any way though, to have the button automatically have the name of the product instead of "Submit". I mean sure since its just two I could simply change that in the form but if there are more in the future it would be nice for the buttons to auto populate with the corresponding product name.
Hmm, no there's no shortcode to access the linked product ID or linked product name from within the CRED form editor. You could use a shortcode with a hard-coded product ID, which would automatically update the product name if it ever changed, but the hard-coded product ID will need to be manually set in every CRED form. It's not automated.
Ok no worries then I will just do it manually 🙂 thanks for everything 🙂