Shopify themes, liquid, logos, and UX
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
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
Solved! Go to the solution
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>
Hi @Sabrii2,
Please go to Customize > Products > Default product > Add block > Custom liquid and add code here:
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!
Thanks Namphan! Unfortunately it is not working! The button is not clickable, it is also transparant.
Hi @Sabrii2,
Please send your site. I will check it.
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>
Thank you! Not transparant anymore! But still not clickable.
Hi @Sabrii2,
Can you re-add it and send me the preview link? I will check it again
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
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.
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!
Hi @AsiyaM,
Can you send me the site link? I will check it in detail
Hi @AsiyaM,
I don't find the code you added and the sticky button, can you add it and send me the preview link?
This worked perfectly for my shop, Dawn v11.0
Hi @Gil-Momo,
If you have any questions, you can contact me. Happy to help you
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
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.
Please check the following video
@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
You can add sticky add to cart:
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.
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