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
Hi everyone,
I hope you're all doing well! I'm looking for assistance with adding a sticky "Add to Cart" button to my product page on Shopify. I’d love to implement this feature, but I'm not very experienced with coding, and I want to ensure I do it correctly without causing any disruptions to my store.
Here are some specifics about what I'm trying to achieve:
Additionally, I've faced alignment issues with other app embeds, which complicates the implementation further. If anyone has experience with this or can guide me on the proper steps to get this done, it would be greatly appreciated!
Thank you for your help!
Best,
Epris Owner
epris.shop (link to my store if needed)
Solved! Go to the solution
This is an accepted solution.
Hi @Épris,
Please go to Actions > Edit code > sections > main-product.liquid file and add code here:
Code:
<div style="
position: fixed;
bottom: 0;
left: 0;
z-index: 9999;
width: 100%;
background: #ffffffbd;
padding: 1rem;
">
<button
id="ProductSubmitButton-Sticky-{{ section.id }}"
type="submit"
name="add"
form="{{ product_form_id }}"
class="product-form__submit button button--full-width button--primary"
style="max-width: 500px; margin: auto;"
>
<span>
{%- if product.selected_or_first_available_variant == null -%}
{{ 'products.product.unavailable' | t }}
{%- elsif 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>
{%- render 'loading-spinner' -%}
</button>
</div>
Hi @Épris ,
Please follow this video
https://www.youtube.com/watch?v=cxA8HriAOAg
If my reply is helpful, kindly click like and mark it as an accepted solution.
If you are happy with my help, you can help me buy a COFFEE
Thanks!
This is an accepted solution.
Hi @Épris,
Please go to Actions > Edit code > sections > main-product.liquid file and add code here:
Code:
<div style="
position: fixed;
bottom: 0;
left: 0;
z-index: 9999;
width: 100%;
background: #ffffffbd;
padding: 1rem;
">
<button
id="ProductSubmitButton-Sticky-{{ section.id }}"
type="submit"
name="add"
form="{{ product_form_id }}"
class="product-form__submit button button--full-width button--primary"
style="max-width: 500px; margin: auto;"
>
<span>
{%- if product.selected_or_first_available_variant == null -%}
{{ 'products.product.unavailable' | t }}
{%- elsif 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>
{%- render 'loading-spinner' -%}
</button>
</div>
This worked like magic! Thanks so much!
hi @Épris,
You're welcome and happy to help 😊