Skip Navigation

[Resolved] Guest can't use checkout for subscription 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.

This topic contains 4 replies, has 2 voices.

Last updated by gregS-9 2 months, 1 week ago.

Assigned support staff: Waqar.

Author
Posts
#2012775

A guest applies for a subscription
Here are the steps:

After a guest fills out a customer registration form they get redirect to the checkout with an error saying
"you must be logged in to checkout."

Is there anyway to make this work so guests don't have to be logged in to buy a subscription?

hidden link
hidden link

I checked off
"Allow customers to place orders without an account"
under Woocommerce Settings > Accounts & Privacy

#2013305

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

I've performed some tests on my website and couldn't reproduce this behavior. It seems some third-party plugin, active theme, or some custom code is restricting guests from visiting the checkout page.

It would be interesting to test this with all non-Toolset plugins disabled (except for WooCommerce) and a default theme like Twenty Twenty-One.

If it's fixed, you can start adding the disabled items, one by one, to narrow down to a possible conflicting one.

I hope this helps and please let me know how it goes.

regards,
Waqar

#2013835
setting-2-issue.png
setting-2.png
setting-1.png

I did some research and it said that Woocommerce Subscriptions will not allow you to access checkout without being logged in or you must set "Allow customers to create an account during checkout" under Woocommerce > Setting > Accounts and Privacy > Account Creation. The problem with having this feature on is that it will create two accounts now if they fill out my CRED form and then go to checkout to fill another form.

I also want guests (with no account yet) to subscribe on checkout.

Please see my attachments to see if you implemented these settings and saw the issue

Setting 1 (This is what I want to implement)
Problem - Checkout will not be accessed after user submits CRED from

Setting 2
Checkout can be accessed after user submits CRED form
The problem with this is it will create 2 accounts if using a CRED User form

#2014687

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing these further details.

Based on what you've shared, the guest checkout option will need to be ruled out as it won't work with the WooCommerce Subscriptions.
( and it makes sense that if someone is getting a subscription product, he/she should have a user account on the website )

This narrows down to only one remaining challenge, as to how to avoid duplicate user creation.

Would it work, if a visitor is automatically logged in after he/she submits the Toolset registration form? This way, when he/she will reach to the checkout page, not only the user account would have been created, but the checkout form will also recognize the logged-in user.

If this sounds like a workable solution, you can use the "cred_save_data" hook to execute some custom code to log in the user, with the submission of the Toolset's user registration form.
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data )

You'll find some good code examples, for a similar requirement, in these forum threads:
https://toolset.com/forums/topic/automatically-log-in-user-after-created/
https://toolset.com/forums/topic/automatic-login-after-registration-with-cred-form/

#2016241

The client and I decided to use a customized woocommerce checkout page as the customer registration form. We won't be needing the Toolset CRED form in this case.