-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save custom fields to new subscriptions and get active subscriptions? #25
Comments
Hi, thanks for getting in touch! Yes, you could store that info in the session and retrieve it when displaying the success page or pass it in the success URL (in the query string). You could also use If your success (thank you) URL is configured to pass the session ID back to the page (that’s the You could also intercept the There are some caveats when using custom fields. You can specify a maximum of 3 custom fields, and they can only be text, number, or dropdown type.
You can do that via the element query, like so: Or, via behaviour attached to the user, like so: I hope this clarifies things a bit. I’ll close this now, but if you have any further questions or if anything above doesn’t make sense, feel free to reach out again! |
Hi @i-just, thanks very much for the detailed and quick response 👍 (For the current project, we decided to stay with the current way / not use this new plugin - but your answer helped very much to evaluate both options. Much appreciated!) I just wondered one thing about the new way: I can add custom fields to subscriptions in the plugin settings, but these are just meant to be filled later via twig or PHP? The challenge with that - as far as I can see - is that I need the stripe webhook to ping craftcms first in order to fill them? Before that the subscription does not exist in craft as far as I saw in my tests. Just as optional feedback. (I guess that's what confused me, because in the old way (craft commerce subscriptions) these can be inserted via POST subscriptions/subscribe directly while subscribing and by seeing the custom field settings screen I assumed this will be the same here in the new plugin) |
Hi @mandrasch, Not a problem at all! I’m glad you found it helpful. We had a chat about the points you made, and we should make adding custom data to subscriptions easier. We’ll have a look at a few options and see how we can improve this. |
Description
Hi, this is more of a question rather than a bug (apologies, but discussions are not open here).
The native subscriptions in Craft Commerce have the ability to set custom fields in POST subscriptions/subscribe
fields[...]
Subscription custom field values, indexed by their handles.How can I achieve this with this new plugin?
I saw that custom field can be attached to subscriptions as well.
Because of the redirect to Hosted Checkout of Stripe, I assume I have to keep this in a session or submit the values I want to store in the thankYou-URL as GET parameter?
What would be the most robust place to do this - after a new subscription was sucessfully paid? 🤔
Use case: I want to store some additional fields to a subscription, e.g.
discountType
for a reduced membership likesenior
,student
, etc. (same product) + some uploaded files for verification. The user enters this information beforehand and pays -and I wanted to store the data and uploaded files within the subscription.Also I'm wondering how I get all current active subscriptions for a user? In craft commerce it was like this:
I'll dig into source code of this plugin, guess it's just not documented in README.md yet?
Thanks very much in advance!
Additional info
The text was updated successfully, but these errors were encountered: