Skip Navigation

[Resolved] Woocommerce Payments with CRED Commerce depending on inventory status

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

Problem: I would like to allow my Users to select different Product variations based on availability, then use CRED Commerce to create an Order and accept payment in WooCommerce.

Solution: CRED Commerce works best with simple products, not variable products. If you only have a few variations of your product, you could separate those into different products first. WooCommerce can track inventory for each product, and you can use WooCommerce Views and conditional HTML to show a CRED Commerce form based on whether or not a product is in stock.

For example, let's say you have Product A and Product B. If Product A is in stock, you want to show your Users a CRED form that allows them to submit a post. If Product B is in stock, you want to show your Users a different CRED form that allows them to register for the site.

On Product A's single post page, you can insert this code to test whether or not Product A is in stock, and show a CRED form:

[wpv-conditional if="( $(views_woo_in_stock) eq '1' )"]
Product A is in stock now!
[cred_form form="submit-post-form"]
[/wpv-conditional]

On Product B's single post page, you can insert this code to test whether or not Product B is in stock, and show a different CRED form:

[wpv-conditional if="( $(views_woo_in_stock) eq '1' )"]
Product B is in stock now!
[cred_form form="register-form"]
[/wpv-conditional]

Relevant Documentation:
https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

This support ticket is created 6 years, 11 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 2 replies, has 2 voices.

Last updated by Edge 6 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#608885

The Toolset documentation explains how to collect payment after submitting a post via woocommerce,

Is it possible to take payment before a post is submitted.

Reason:
I have product variables but only one of each, I would like the user to be able to check which product variable is available...

...if available they can then go on to pay and submit a post.

Please could you advise and point me in the right direction.

Many thanks

#609101

Hi, CRED Commerce works best with simple products, not variable products. If you only have a few variations of your product, you could separate those into different products first. WooCommerce can track inventory for each product, and you can use WooCommerce Views and conditional HTML to show a CRED Commerce form based on whether or not a product is in stock.

For example, let's say you have Product A and Product B. If Product A is in stock, you want to show your Users a CRED form that allows them to submit a post. If Product B is in stock, you want to show your Users a different CRED form that allows them to register for the site.

On Product A's single post page, you can insert this code to test whether or not Product A is in stock, and show a CRED form:

[wpv-conditional if="( $(views_woo_in_stock) eq '1' )"]
Product A is in stock now!
[cred_form form="submit-post-form"]
[/wpv-conditional]

On Product B's single post page, you can insert this code to test whether or not Product B is in stock, and show a different CRED form:

[wpv-conditional if="( $(views_woo_in_stock) eq '1' )"]
Product B is in stock now!
[cred_form form="register-form"]
[/wpv-conditional]

Would this work in your case, or am I missing something?

#609935

thankyou