Dawn is not compatible with selling plans

Solved
DanielTehrani
Explorer
49 1 7

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.

0 Likes
colinloretz
Excursionist
16 2 5

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.

DanielTehrani
Explorer
49 1 7

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

 

0 Likes
colinloretz
Excursionist
16 2 5

This is an accepted solution.

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

DanielTehrani
Explorer
49 1 7

That worked!

Thank you so much @colinloretz!

0 Likes
Conjured_Char
Shopify Partner
23 0 2

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

chris_mctavish
Tourist
9 0 1

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?

0 Likes
chris_mctavish
Tourist
9 0 1

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

0 Likes