We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

How can I add a sticky cart button to Dawn Theme V10?

Solved

How can I add a sticky cart button to Dawn Theme V10?

Sabrii2
Tourist
9 0 2

Hello! I want to have a sticky add to cart button (at the bottom) on my productpage. Can anyone help me! I have Dawn Theme V10

Accepted Solution (1)
namphan
Shopify Partner
2777 358 407

This is an accepted solution.

Hi @Sabrii2,

Please go to Actions > Edit code > main-product.liquid file and paste this at the bottom of the file:

<button
id = "ProductSubmitButton-Sticky"
type="submit"
name="add"
form="{{ 'product-form-' | append: section.id }}"
class="product-form__submit button button--full-width button--primary"
{% if product.selected_or_first_available_variant.available == false or quantity_rule_soldout %}
  disabled
{% endif %}
style="position: fixed;bottom: 0;left: 0;margin-bottom: 0;z-index: 999;"
>
	<span>
	  {%- if product.selected_or_first_available_variant.available == false or quantity_rule_soldout -%}
		{{ 'products.product.sold_out' | t }}
	  {%- else -%}
		{{ 'products.product.add_to_cart' | t }}
	  {%- endif -%}
	</span>
	<div class="loading-overlay__spinner hidden">
	  <svg
		aria-hidden="true"
		focusable="false"
		class="spinner"
		viewBox="0 0 66 66"
		xmlns="http://www.w3.org/2000/svg"
	  >
		<circle class="path" fill="none" stroke-width="6" cx="33" cy="33" r="30"></circle>
	  </svg>
	</div>
</button>
Coffee tips fuels my dedication.
Shopify Development Service
PageFly Page Builder Optimize your Shopify store (Free plan available)
Need help with your store? namphan992@gmail.com

View solution in original post

Replies 22 (22)

namphan
Shopify Partner
2777 358 407

Hi @Sabrii2,

Please go to Customize > Products > Default product > Add block > Custom liquid and add code here:

Screenshot.png

Code:

<button
id = "ProductSubmitButton-Sticky"
type="submit"
name="add"
form="{{ 'product-form-' | append: section.id }}"
class="product-form__submit button button--full-width button--primary"
{% if product.selected_or_first_available_variant.available == false or quantity_rule_soldout %}
  disabled
{% endif %}
style="position: fixed;bottom: 0;left: 0;margin-bottom: 0;"
>
	<span>
	  {%- if product.selected_or_first_available_variant.available == false or quantity_rule_soldout -%}
		{{ 'products.product.sold_out' | t }}
	  {%- else -%}
		{{ 'products.product.add_to_cart' | t }}
	  {%- endif -%}
	</span>
	<div class="loading-overlay__spinner hidden">
	  <svg
		aria-hidden="true"
		focusable="false"
		class="spinner"
		viewBox="0 0 66 66"
		xmlns="http://www.w3.org/2000/svg"
	  >
		<circle class="path" fill="none" stroke-width="6" cx="33" cy="33" r="30"></circle>
	  </svg>
	</div>
</button>

Hope it helps!

Coffee tips fuels my dedication.
Shopify Development Service
PageFly Page Builder Optimize your Shopify store (Free plan available)
Need help with your store? namphan992@gmail.com
Sabrii2
Tourist
9 0 2

Thanks Namphan! Unfortunately it is not working! The button is not clickable, it is also transparant. 

namphan
Shopify Partner
2777 358 407

Hi @Sabrii2,

Please send your site. I will check it.

Coffee tips fuels my dedication.
Shopify Development Service
PageFly Page Builder Optimize your Shopify store (Free plan available)
Need help with your store? namphan992@gmail.com
Sabrii2
Tourist
9 0 2

Thank you! www.belloti.nl

namphan
Shopify Partner
2777 358 407

This is an accepted solution.

Hi @Sabrii2,

Please go to Actions > Edit code > main-product.liquid file and paste this at the bottom of the file:

<button
id = "ProductSubmitButton-Sticky"
type="submit"
name="add"
form="{{ 'product-form-' | append: section.id }}"
class="product-form__submit button button--full-width button--primary"
{% if product.selected_or_first_available_variant.available == false or quantity_rule_soldout %}
  disabled
{% endif %}
style="position: fixed;bottom: 0;left: 0;margin-bottom: 0;z-index: 999;"
>
	<span>
	  {%- if product.selected_or_first_available_variant.available == false or quantity_rule_soldout -%}
		{{ 'products.product.sold_out' | t }}
	  {%- else -%}
		{{ 'products.product.add_to_cart' | t }}
	  {%- endif -%}
	</span>
	<div class="loading-overlay__spinner hidden">
	  <svg
		aria-hidden="true"
		focusable="false"
		class="spinner"
		viewBox="0 0 66 66"
		xmlns="http://www.w3.org/2000/svg"
	  >
		<circle class="path" fill="none" stroke-width="6" cx="33" cy="33" r="30"></circle>
	  </svg>
	</div>
</button>
Coffee tips fuels my dedication.
Shopify Development Service
PageFly Page Builder Optimize your Shopify store (Free plan available)
Need help with your store? namphan992@gmail.com
Sabrii2
Tourist
9 0 2

Thank you! Not transparant anymore! But still not clickable. 

namphan
Shopify Partner
2777 358 407

Hi @Sabrii2,

Can you re-add it and send me the preview link? I will check it again

Coffee tips fuels my dedication.
Shopify Development Service
PageFly Page Builder Optimize your Shopify store (Free plan available)
Need help with your store? namphan992@gmail.com
Sabrii2
Tourist
9 0 2

Dear Namphan, 
It works! Thank you very much! Can i adjust the moment that the button sticks. For example after scrolling down when the add to cart button is not more in sight?

Greetss

namphan
Shopify Partner
2777 358 407

Hi @Sabrii2,

This will take many steps and debug, so it is difficult for me to guide you in detail.

Hope it is clear to you.

 

Coffee tips fuels my dedication.
Shopify Development Service
PageFly Page Builder Optimize your Shopify store (Free plan available)
Need help with your store? namphan992@gmail.com
AsiyaM
Tourist
5 0 1

Hi, this is really helpful, thank you! I want to change the color of the button and add a black border, if possible. Would you kindly let me know how I can do that? Could I add some more code here to configure the color? Thanks in advance!

namphan
Shopify Partner
2777 358 407

Hi @AsiyaM,

Can you send me the site link? I will check it in detail

Coffee tips fuels my dedication.
Shopify Development Service
PageFly Page Builder Optimize your Shopify store (Free plan available)
Need help with your store? namphan992@gmail.com
AsiyaM
Tourist
5 0 1

Sure! It's Crescentt.com

namphan
Shopify Partner
2777 358 407

Hi @AsiyaM,

I don't find the code you added and the sticky button, can you add it and send me the preview link?

Coffee tips fuels my dedication.
Shopify Development Service
PageFly Page Builder Optimize your Shopify store (Free plan available)
Need help with your store? namphan992@gmail.com
Gil-Momo
Excursionist
30 0 4

This worked perfectly for my shop, Dawn v11.0

namphan
Shopify Partner
2777 358 407

Hi @Gil-Momo,

If you have any questions, you can contact me. Happy to help you

Coffee tips fuels my dedication.
Shopify Development Service
PageFly Page Builder Optimize your Shopify store (Free plan available)
Need help with your store? namphan992@gmail.com
Gil-Momo
Excursionist
30 0 4

Hi,

How can I change the colour of the button? I used your code and the button is currently in black. could you tell me how to change it color?

Thanks,

Gil

Antonynex
Explorer
77 3 7

Dear Namphan, i saw you post about the sticky add to card button.  My question is i have a sticky add to card button on my shopify dawn theme but the collor is black and i have tryed everything i can think of to change the color, but i can't see to get it to work i need it to be the same orange color as the rest of my add to card button. Could you please help me how i can solve this, Best Regards Anton.Schermafbeelding 2024-11-22 211435.png

dmwwebartisan
Shopify Partner
12384 2560 3749

@Sabrii2 

Please check the following video

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com |  Instagram: @dmw.webartisan
PageFly App to customize your pages | The most powerful Shopify page builder app

Ugurcan
Shopify Partner
351 7 34

@namphan We recently released a sticky cart app with a free plan. It works with all themes including Dawn, check it out: https://apps.shopify.com/pasilobus-sticky-cart


Pasilobus | eCommerce Experts, Shopify Apps & Development since 2015 -- www.pasilobus.com

MRamzan
Shopify Partner
533 3 46

You can add sticky add to cart:

 

Hire Me:

WhatsApp: +91-9145985880
Email: mohdramzaan112@gmail.com
Skype: mohdramzaan112
Antonynex
Explorer
77 3 7

Thank  you all for the information, i have found and changed the color of my sticky add to card button.

but now i see it is not clickable and because i allready have a sticky add to card button on the store i like to repair or make it work again, is there someone that could check the code of it in my post here: https://community.shopify.com/c/shopify-scripts/make-sticky-add-to-card-button-clickable/td-p/285631...  and maybe rewrite or fix the possible errors in it why it is not clickable.

Katre
Shopify Partner
2 0 0

If you're not comfortable with code and want a solution where you can easily setup sticky add to cart for any theme and adjust settings separately for mobile and desktop, there's a tutorial on how to set it up using a Free Essential Sticky Add to Cart app: https://www.youtube.com/watch?v=q8koxDwcszo&ab_channel=Essentials 

 

 Essential Sticky Add to Cart bar for any theme