Questions, troubleshooting, and feedback on Subscription APIs
We've been trying to update our subscription app to be compatible with onlinestore 2.0.
Dawn seems to not be compatible with selling plans. event if we set the input element(with name="selling_plan"')'s value to a selling plan id, the one-time purchase item goes into the cart (selling plan selection is ignored).
We tried in two ways
, but both didn't work.
Is this an issue with the Dawn theme or should we do something to be compatible with the new theme architecture?
Thanks.
Solved! Go to the solution
This is an accepted solution.
@d_tehrani, give this a shot!
This is very specific to Dawn but when you submit the form while Javascript is enabled, the form will be submitted by assets/product-form.js.
If you console.log the serialized form that product-form.js sends to the cart_add_url, it will not include any of the fields you add unless it is added to the form explicitly.
<input type="radio" name="selling_plan" value="{{ selling_plan.id }}" style="display: none" form="product-form-{{ section.id }}">
This is a radio input but would work the same with your hidden input.
Can you share what the input field looks like on your end?
We were able to add a selling_plan selector section to Dawn but it required a few more attributes than our previous theme.
Thanks for the reply!
This is our input element.
<input
type="hidden"
name="selling_plan"
value="{{ current_selling_plan_allocation.selling_plan.id }}"
id="id-for-us-to-use-as-reference"
>
This is an accepted solution.
@d_tehrani, give this a shot!
This is very specific to Dawn but when you submit the form while Javascript is enabled, the form will be submitted by assets/product-form.js.
If you console.log the serialized form that product-form.js sends to the cart_add_url, it will not include any of the fields you add unless it is added to the form explicitly.
<input type="radio" name="selling_plan" value="{{ selling_plan.id }}" style="display: none" form="product-form-{{ section.id }}">
This is a radio input but would work the same with your hidden input.
@colinloretz Piggy-backing on this. We are working on an app block that needs to add selling plans to the form. It doesn't look like app blocks have access to the section.id they are included in. How would we go about adding a selling plan to the form when we don't have access to that ID? Or am I missing something and we do actually have access? Thanks!
Echoing this question. We can render our product page widget using the app block, but {{ section.id }} does not result in any value.
Do we need to do some kind of autofill in the schema? Are any subscriptions apps doing this successfully yet?
Is anybody able to assist with getting App Blocks to work for subscriptions? We can't find any documentation on how to allow the app block to know which form ID we should attach to the selling_plan form field. @ewalker or somebody else from Shopify able to help with this??
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023