Simple Cart & Buy Now
[resolved] Add to Cart without reloading page? (4 posts)

  1. r1987
    Posted 3 years ago #


    Just a staight question to everyone, that is using this plugin.

    is there a way to ajaxify the Add to Cart button also? Like so, that when i click on the Add to Cart it wouldn't redirect me to the single.php page of the product, but changes the number of items in the cart with out reloading the page?


  2. bluey80
    Plugin Author

    Posted 3 years ago #

    I don't know how to do that, but it would nice. Code suggestions welcome.

  3. r1987
    Posted 3 years ago #


    But can you say, what's the action for adding an item? When I click on the add to cart button, it redirects me to the single page of the product.

    When im at the checkout page, and i click remove, then i can see that the request for removing an item is ?remove=product_name . I tried to use ?add_item=product_name and that doesn't add anything to the cart.

    As much as i've been searching around the AJAX thing, then it needs an ?add_item request to add the product to the cart at the background.

  4. bluey80
    Plugin Author

    Posted 3 years ago #

    It is a form. Using my site (iguanaworks.net) as a reference, here's the relevent form for adding a part:

    <form method='post' class='wired-receiver' action='http://iguanaworks.net/products/usb-accessories/ir-receivers/'>
    <input type='hidden' value='add_item' name='action'/>
    <input type='hidden' class='item_url' value='http://iguanaworks.net/?page_id=206' name='item_url'/>
    <input type='hidden' value='wired-receiver' name='item_id'/>
    <input type='hidden' class='item_name' value='Wired Receiver' name='item_name'/>
    <input type='hidden' class='item_price' value='7' name='item_price'/>
    <input type='hidden' class='item_shipping' value='' name='item_shipping'/>
    <input type='hidden' class='item_weight' value='' name='item_weight'/>
    <p id='cartname'>Wired Receiver</p><p id='cartcontent'>Unit Price: $7.00 each<br/>Qty: <input type='text' class='item_qty' value='1' size='2' name='item_qty'/>
    <input type='submit' id='wired-receiver' class="add" name='add' value='Add To Cart'/>

    The action points to the current page you are on. Then a bunch of hidden name/value pairs: action:add_item; item_url:http://blah;item_price:7;

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Cart & Buy Now
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic