Re: Remove Add to Cart Button for Non-Registered Users Impulse theme

Solved

Remove Add to Cart Button for Non-Registered Users Impulse theme

pommedeterre
Visitor
1 0 0

I operate a wholesale website using the Impulse theme. I would like to restrict the "Add to Cart" functionality so that it's only available to registered users with an account. However, I'm having trouble locating the specific section of code that renders the "Add to Cart" button.

Could you please provide guidance on:

  1. The file or section of code responsible for rendering the "Add to Cart" button
  2. How to modify this code to hide or disable the button for non-registered users

Your assistance in this matter would be greatly appreciated.

Thank you for your help.

Accepted Solution (1)

oscprofessional
Shopify Partner
16115 2409 3121

This is an accepted solution.

Hello @pommedeterre 

This needs to be handled through code

  1. From your Shopify admin, navigate to Online Store > Themes.
  2.  Click Actions > Edit code.
  3. Navigate to product-form.liquid file
  4. Search for "add-to-cart
  5. Now replace the existing button with  below code

    {% if customer %}
    <button
    {% if product.empty? %}
    type="button"
    {% else %}
    type="submit"
    {% endif %}
    name="add"
    data-add-to-cart
    class="btn btn--full add-to-cart{% if enable_dynamic_buttons and product.selling_plan_groups == empty %} btn--secondary{% endif %}"
    {% unless current_variant.available %}
    disabled="disabled"
    {% endunless %}
    >
    <span data-add-to-cart-text data-default-text="{{ default_text }}">
    {{ button_text }}
    </span>
    </button>
    {% else %}
    <button
    disabled="disabled"
    {% if product.empty? %}
    type="button"
    {% else %}
    type="submit"
    {% endif %}
    name="add"
    data-add-to-cart
    class="btn btn--full add-to-cart{% if enable_dynamic_buttons and product.selling_plan_groups == empty %} btn--secondary{% endif %}"
    {% unless current_variant.available %}
    disabled="disabled"
    {% endunless %}
    >
    <span data-add-to-cart-text data-default-text="{{ default_text }}">
    {{ button_text }}
    </span>
    </button>
    {% endif %}

    I hope this solution meets your needs.
    Thank you!!



Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free

View solution in original post

Replies 2 (2)

parth_ghelani
Shopify Partner
229 32 31

Hello @pommedeterre 

You need to disable add to cart button on product page or at everywhere where it says "Add to Cart" ?

Find the file named "buy-buttons.liquid" in snippets if your theme contains this file. Usually Add to cart button placed in this file.

I can check it and fix it. but for that i need the access of your admin so i can check and make changes in code side to fix your issue.

 

Was my reply helpful? Click Like to let me know!
Was your question answered? Mark it as an Accepted Solution.

Best Regards

Parth ghelani

Was your question answered? Mark it as an Accepted Solution.
If you need further assistance to optimize your store, please don't hesitate to reach out. I'm committed to providing you with my full support and ensuring that you get the most out of our collaboration.

Get in Touch: You can contact me directly at softkarts@gmail.com for any questions or concerns

oscprofessional
Shopify Partner
16115 2409 3121

This is an accepted solution.

Hello @pommedeterre 

This needs to be handled through code

  1. From your Shopify admin, navigate to Online Store > Themes.
  2.  Click Actions > Edit code.
  3. Navigate to product-form.liquid file
  4. Search for "add-to-cart
  5. Now replace the existing button with  below code

    {% if customer %}
    <button
    {% if product.empty? %}
    type="button"
    {% else %}
    type="submit"
    {% endif %}
    name="add"
    data-add-to-cart
    class="btn btn--full add-to-cart{% if enable_dynamic_buttons and product.selling_plan_groups == empty %} btn--secondary{% endif %}"
    {% unless current_variant.available %}
    disabled="disabled"
    {% endunless %}
    >
    <span data-add-to-cart-text data-default-text="{{ default_text }}">
    {{ button_text }}
    </span>
    </button>
    {% else %}
    <button
    disabled="disabled"
    {% if product.empty? %}
    type="button"
    {% else %}
    type="submit"
    {% endif %}
    name="add"
    data-add-to-cart
    class="btn btn--full add-to-cart{% if enable_dynamic_buttons and product.selling_plan_groups == empty %} btn--secondary{% endif %}"
    {% unless current_variant.available %}
    disabled="disabled"
    {% endunless %}
    >
    <span data-add-to-cart-text data-default-text="{{ default_text }}">
    {{ button_text }}
    </span>
    </button>
    {% endif %}

    I hope this solution meets your needs.
    Thank you!!



Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free