Support » Plugin: WooCommerce Cart » Custom Add to cart button

  • Daniel

    (@damen02)


    Hi. Congrats for this great plugin!
    I have a custom “Add to cart” button for selling audio tracks from playlists.
    It works fine to add products in the basket, but doesn’t auto open the side cart.
    My functionality is based on JS and browser query strings.
    Any lead for solving this? Thanks!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author xootix

    (@xootix)

    Hi,

    Your button should have the following attributes.
    Class – ajax_add_to_cart & add_to_cart_button
    Product id – data-product_id
    Check screenshot here
    https://i.imgur.com/KPXZEn7.png

    Daniel

    (@damen02)

    Wow, that was fast! And works!
    Sadly, I have some conflicts with my customizations. I’ll need to work on it.
    Thanks anyway, you were quick 🙂

    12va

    (@12va)

    Howdy – what if you are trying send data from a pre-made button in a 3rd party plug-in?

    It allows you to specify a URL: http://example.com via a small text box.

    How might I cram those attributes into a long query string? I tried this:

    ?add-to-cart="2492"&data-quantity="1"&data-product_id="2492"%20class="add_to_cart_button%20ajax_add_to_cart"

    and also tried the other parameters specified:

    ?add-to-cart="2492"&data-quantity="1"&data-product_id="2492"&data-product-sku&class="button%20product_type_simple%20add_to_cart_button%20ajax_add_to_cart"
    

    But can’t seem to get the sidebar cart to open when clicked. It does add it to the cart, though… but what I like about the plugin is when something is added to the cart, the sidebar cart opens as a means of response to user action. Pretty cool. Just need to figure out how to make it work in a pre-made button. Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Add to cart button’ is closed to new replies.