Note: This page assume that you have a Shopify 2.0 theme, or have already added a product.json file to your Shopify 1.0 theme. If you haven't done this yet, or you aren't sure what version theme you have, click here.
I can't add an app block
Did you get to the add app block section of the tutorial and find that you're unable to add an app block because you do not have the option to? This may be because you have not enabled app block functionality in your theme.
If you are on a Shopify 2.0 theme, this article will help you enable app blocks in the product section of your PDP. This will enable you to add the TryNow app block, and enable the TryNow purchase option.
To enable app blocks, please follow Shopify's instructions ("Add support for app blocks to sections"), found here: Shopify instructions. Please note that these instructions can apply to any section of your product template, but specifically need to be enabled for the product section for TryNow.
Once the above change is made, you'll be able to add the TryNow button to the appropriate place within your theme in the product section. You now need to ensure the TryNow button renders in the appropriate place on your page (i.e. below the add to cart button). To do this, insert this code in the appropriate section of your Product Section, where you would like the TryNow button to render.
{% for block in section.blocks %}
{% case block.type %}
{% when '@app' %}
{% render block %}
{% endcase %}
{% endfor %}After enabling app blocks and allowing them to render, you should be able to add the TryNow button to your Product template, as shown below.
Where should I insert the app block?
You'll want to ensure that your product page template is broken out into sections that allow the TryNow Button to be inserted next to your standard add-to-cart button. When done correctly, you'll see that the TryNow Button can be inserted in the correct location, as outlined below:
How do I know if my theme renders app blocks?
If you're unsure whether your theme renders app blocks and would like to check, follow the instructions below for a quick check.
Note: your theme may be set up differently so the best way to be sure is by reaching out to Shopify Support.
Go to Shopify > Online Store > Themes > click on the three dots > Edit code
Search for the
product-template.liquid
file in the search bar. It could also be calledmain-product.liquid
orproduct.liquid
or another.liquid
file.Search (ctrl+f) for the code
when '@app'
Usually if this code exists in one of your product liquid files, then it means that your theme can render app blocks.
โ