Dawn v12 - add custom button to shopify page

Topic summary

A user wants to add a standalone Buy button for a specific product on a Shopify page using the Dawn v12 theme, without displaying other product details.

Initial Problem:

  • Buy Button sales channel code doesn’t work when added to the Custom Liquid section
  • Found alternative code that displays a button, but it’s non-functional
  • Uncertainty about JavaScript support in Custom Liquid sections

Solution Provided:

  • JavaScript is allowed in Custom Liquid sections, though functionality depends on implementation
  • The code snippet shared was identified as problematic/nonsensical
  • A simpler approach was recommended using Shopify’s product form:
    {% assign product = all_products[PRODUCT-HANDLE] %}
    {% form 'product', product %}
    [form fields]
    {% endform %}
    
  • Reference provided to Shopify’s official documentation on product forms and templates

Status: Solution offered but not yet confirmed as implemented or tested by the original poster.

Summarized with AI on November 13. AI used: claude-sonnet-4-5-20250929.

I have a page where I just want to add a Buy button for a particular product without any other product details.

I tried generating code using the Buy Button sales channel, but when I add it to the “Custom liquid” section on the page the code doesn’t work.

I found the following code from a different location, but when I add it in even though the button shows up, it doesn’t do anything. (Is javascript allowed in the custom liquid section?)

Any ideas?

{%- style -%}
.product_wrapper{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;}
{%- endstyle -%}

{% assign product = "test-prod2" %} {% assign selling = product.selling_plan_groups[0].selling_plans[0].id %}

{{settings.first_product_text}}

Javascript is allowed in the custom-liquid, whether what you put in actually works is another matter.

And that liquid code is nonsense, avoid consuming the unfamiliar.

Simplest, roughly

{% assign product = all_products[YOUR-PRODUCT-HANDLE-HERE] %}
{% form 'product', product %}
 
 
 
{% endform %}

Learn

https://shopify.dev/docs/themes/architecture/templates/product#the-product-form

https://shopify.dev/docs/api/liquid/tags/form#form-product

If you need this customization created then contact me by my email for services.
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.