Can you import a form directly using ID or name in Dawn template?

Can you import a form directly using ID or name in Dawn template?

Arminda
Visitor
2 0 0

Hello, I'm using the Dawn template and the Forms addon from Shopify. I'd like to inquire whether it's possible to import or include a form directly using its ID or name?

Somthing like this 

04.10.2023_12.49.20_REC.png


Thank you

Replies 7 (7)

syedsumaimaly
Trailblazer
147 16 22

Hi @Arminda 

  1. You can do this by going to Online Store > Themes > Actions next to the theme you want to edit > Customize. Then, click Forms and select the form you want to import or include. The ID or name of the form will be displayed in the Form ID or Form Name field.
  2. In the Dawn template, go to the page or section where you want to import or include the form.
  3. Add the following code to the page or section:

 

{% include 'forms/form.liquid' with form_id: 'YOUR_FORM_ID' %}

 

 If I managed to help you then, don't forget to Like it and Mark it as Solutions.

Arminda
Visitor
2 0 0

Thanks in advance for the quick reply. However, I'm encountering an error, and I'm unsure whether it's something I'm doing wrong or what might be causing it.

04.10.2023_14.26.29_REC.png

 

aprya
Visitor
1 0 0

Hi Amanda, Did you manage to correct this as I am having the same issue. 

HarshilK
Visitor
2 0 0

Hi Aprya did you find any solutions? for 

prettypetty
Shopify Partner
11 0 1

Include is deprecated, try render.

Shopify partner since 2017
Liquid lover
mike7
Visitor
1 0 0

i tried what was suggested, in my case i added it to the main-cart-footer as thats where i want my form, i am also using the shopify forms app with the dawn theme
{% render 'forms/form.liquid' with form_id: '132696' %}

but it gives this error on the front end 
Liquid error (sections/main-cart-footer line 114): Could not find asset snippets/forms/form.liquid

i am guessing it cant find the location of the form from the app but not sure know how to find that out 

seems like snippets/ is being appended to the url when i dont want it to be 

MC_Elliot
Shopify Partner
3 0 4

Hello! I found a partial solution to this problem

I add a new block in the schema in the .liquid file in question:
"blocks": [
   {
       "type": "@app"
   }
]


And I call it as in the "apps.liquid" file:
{%- for block in section.blocks -%}
    {% render block %}
{%- endfor -%}

It becomes accessible in my file, and I can style it as I like!

Have a great day!