Skip Navigation

[Resolved] Cred Commerce not adding product to form (woo subscription)

This thread is resolved. Here is a description of the problem and solution.

Problem: When I load the page containing my CRED Commerce form, it looks like a form to create a new Product. Nothing is added to my cart.

Solution: CRED Commerce is designed to create a post, so if you select the Product post type the form will allow you to create a Product post. This is expected. If you do not want to create a new Product or standard Post, you can create a new custom post type specifically for this process. When the form is submitted, a new post will be created and the selected linked Product will be added to the user's cart.

Relevant Documentation: https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/

This support ticket is created 7 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.

Our next available supporter will start replying to tickets in about 2.18 hours from now. Thank you for your understanding.

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)

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by martinN-3 7 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#555681

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 🙂

#555703
Screen Shot 2017-08-02 at 11.23.22 AM.png

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.

#555716
cred-commerce-settings.png
complete-form.png

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 😉

#555722

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.

#555723

"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?

#555761

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.

#555799

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.

#555830

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.

#555831

Ok no worries then I will just do it manually 🙂 thanks for everything 🙂