Dawn theme code editing

Topic summary

A user is attempting to modify their Dawn theme (version 15.3.0) to block ordering from specific collections during a festive period (December 9, 2025 to March 3, 2026). They received code from ChatGPT that should replace the submit button line in main-product.liquid, but are unable to locate the correct code section to edit.

The proposed solution includes:

  • Date-based blocking logic using Liquid template variables
  • A list of blocked collection handles (vegan cakes, cupcakes, gluten-free items, etc.)
  • A disabled button with a message: “Regular orders closed till 3/3/26 :warning:” and “Regular orders reopening 3rd March 2026”
  • Custom styling for the disabled state

Current status: The discussion remains open with no responses yet. The user is seeking help locating where to implement this code or alternative approaches to achieve collection-specific ordering restrictions during specified dates.

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

Hi!
I’m trying to edit my Dawn theme (15.3.0) code to allow me to block out ordering of certain collections during my festive period dates. I’ve tried going to chatgpt for advise but am stuck because I can’t find the code to edit.

Any help or advise / alternatives would be greatly appreciated please!

Thank you!

I’m supposed to replace the {{ form | submit_button: ... }} line in the main-product.liquid section.

with: {% assign current_date = ‘now’ | date: “%s” %}
{% assign start_block = ‘2025-12-09 00:00:00’ | date: “%s” %}
{% assign end_block = ‘2026-03-03 00:00:00’ | date: “%s” %}

{% comment %}
Block ordering for these collections during the specified period.
Handles are the lowercase, hyphenated versions of your collection names.
{% endcomment %}
{% assign blocked_collections =
“vegan-vegetarian-cakes,vegan-vegetarian-and-or-gluten-free-cupcakes,cakes,cupcakes-mini-cupcakes,gluten-free-some-options-of-vegan,vegan-glutenfree-cookies,cookies,loving-mum”
| split: “,” %}

{% assign block_this_product = false %}
{% for c in product.collections %}
{% if blocked_collections contains c.handle %}
{% assign block_this_product = true %}
{% endif %}
{% endfor %}

{% if current_date > start_block and current_date < end_block and block_this_product %}

⚠️ Regular orders closed till 3/3/26
Regular orders reopening 3rd March 2026 {% else %} {{ form | submit_button: 'Add to cart', class: 'product-form__submit button button--full-width button--primary' }} {% endif %}
1 Like

Hi @25grams

Perfect — you’re very close!
Let me guide you step-by-step so you can safely add this “block ordering for certain collections during festive dates” feature to your Dawn 15.3.0 theme.

Step-by-Step Setup

Open the correct file

In your Shopify admin:

  • Go to Online Store → Themes → Dawn (15.3.0) → Edit code
  • Open the file:
sections/main-product.liquid
  • Scroll down until you find this line (around line 450–550 typically):
{{ form | submit_button: 'Add to cart', class: 'product-form__submit button button--full-width button--primary' }}

That’s the button you’ll replace.

Replace that line with the following code

Use this cleaned, correct version (your version had curly quotes “ ” instead of straight quotes " " — Liquid will break if you use curly quotes).

{% assign current_date = 'now' | date: "%s" %}
{% assign start_block = '2025-12-09 00:00:00' | date: "%s" %}
{% assign end_block = '2026-03-03 00:00:00' | date: "%s" %}

{% comment %}
Block ordering for these collections during the specified period.
Handles are the lowercase, hyphenated versions of your collection names.
{% endcomment %}
{% assign blocked_collections = "vegan-vegetarian-cakes,vegan-vegetarian-and-or-gluten-free-cupcakes,cakes,cupcakes-mini-cupcakes,gluten-free-some-options-of-vegan,vegan-glutenfree-cookies,cookies,loving-mum" | split: "," %}

{% assign block_this_product = false %}
{% for c in product.collections %}
  {% if blocked_collections contains c.handle %}
    {% assign block_this_product = true %}
  {% endif %}
{% endfor %}

{% if current_date > start_block and current_date < end_block and block_this_product %}
  <div class="product-form__blocked" style="color:#b30000; font-weight:600; margin-top:1rem;">
    ⚠️ Regular orders closed till <strong>3 March 2026</strong><br>
    Regular orders will reopen on <strong>3rd March 2026</strong>.
  </div>
{% else %}
  {{ form | submit_button: 'Add to cart', class: 'product-form__submit button button--full-width button--primary' }}
{% endif %}

Best regards,
Devcoder :laptop:

Because it’s bot generated response making up nonsense and the poster not bothering to check for any context.
Dawn themes product add-to-cart form should be in the buy-button snippet
https://github.com/Shopify/dawn/blob/main/snippets/buy-buttons.liquid#L39

Further :clipboard: Edit your post to put the code in a full code block, or inside a summary element(click the options circle-button-with-plus-sign on the end of the formatting bar in the post editor)

DON’T POST GIANT WALLS OF TEXT, either find small relevant parts or put in the effort to format properly.

Use the actual formatting features, or literally link to an open source version of the file e.g. https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L481

Avoid posting the entirety of a themes code, some code you are not allow to share, dawn is free so is okay but it’s a nasty & dangerous habit to have if you ever get a premium theme.

Respect others time , would you make your grandma scroll through all that noise?

Why would you do it to a stranger you want to help YOU.
It’s the type of thing that encourages MORE bot posts and for actual experts to learn to ignore you when you have a serious problem.

1 Like

Agree with @PaulNewton

Without reading your entire posts, this is not the best approach.

Checking dates in theme code is not accurate and it would not really block ordering.

Better option would be to zero/restore inventory of these products based on schedule. Flow can do that.

Hi all!

Thank you for your replies.

I’ve taken down the main-product.liquid codes and will check out the snippet! https://github.com/Shopify/dawn/blob/main/snippets/buy-buttons.liquid#L39