Solved

Dawn is not compatible with selling plans

d_tehrani
Shopify Partner
56 1 13

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

  1. Created a theme app extension that inserts the necessary code into the product page
  2. Directly edit the product page's liquid to render selling plans

, 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.

Accepted Solution (1)
colinloretz
Excursionist
16 2 7

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.

View solution in original post

Replies 7 (7)

colinloretz
Excursionist
16 2 7

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.

d_tehrani
Shopify Partner
56 1 13

@colinloretz 

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

 

colinloretz
Excursionist
16 2 7

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.

d_tehrani
Shopify Partner
56 1 13

That worked!

Thank you so much @colinloretz!

Conjured_Char
Shopify Partner
36 0 4

@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!

simplee_chris
Shopify Partner
55 3 14

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?

simplee_chris
Shopify Partner
55 3 14

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