Comments on: Add to Cart Interaction https://codyhouse.co/gem/add-to-cart-interaction/ A free library of HTML/CSS/Javascript resources to boost your web projects and learn new tricks. Tue, 07 Nov 2017 03:16:46 +0000 hourly 1 http://wordpress.org/?v=4.2.12 By: Ramses Garcia https://codyhouse.co/gem/add-to-cart-interaction/#comment-9005 Fri, 03 Mar 2017 05:53:00 +0000 https://codyhouse.co/?post_type=gem&p=14417#comment-9005 Can i integrate this with products that have been call with a loop made with php? i want to add to the cart products that are shown with the result of a query

]]>
By: Ahad Arzi https://codyhouse.co/gem/add-to-cart-interaction/#comment-8966 Thu, 23 Feb 2017 08:25:00 +0000 https://codyhouse.co/?post_type=gem&p=14417#comment-8966 Hi, I have problem. How can i change the cart bucket image into some other image, I have tried in css , html. I never mind any solutions. Can you help me please.

]]>
By: Vitali https://codyhouse.co/gem/add-to-cart-interaction/#comment-8752 Wed, 04 Jan 2017 23:43:00 +0000 https://codyhouse.co/?post_type=gem&p=14417#comment-8752 Why there’s only one product example? Where do you put the next product? Bad demo.

]]>
By: zapcriativo https://codyhouse.co/gem/add-to-cart-interaction/#comment-8686 Tue, 13 Dec 2016 17:03:00 +0000 https://codyhouse.co/?post_type=gem&p=14417#comment-8686 How to use the value with real currency format, with comma?

I tried inserting replace .replace (‘$’, ”) with .replace (‘$’, ‘.’, ‘,’), But returned NaN.

]]>
By: Jaber Salehi https://codyhouse.co/gem/add-to-cart-interaction/#comment-8624 Sat, 26 Nov 2016 10:31:00 +0000 https://codyhouse.co/?post_type=gem&p=14417#comment-8624 What if users leave the website after adding a product, Or maybe he want to access that cart in another device, I think the best choice is to send the info to database after he clicks on add,

]]>
By: varun https://codyhouse.co/gem/add-to-cart-interaction/#comment-8601 Sun, 20 Nov 2016 19:57:00 +0000 https://codyhouse.co/?post_type=gem&p=14417#comment-8601 1. Create another addToCartBtn like below code
// Previous code
var addToCartBtn = $(‘.cd-add-to-cart’);
// Added code
var addToCartBtn2 = $(‘.cd-add-to-cart-2′);

2. Create another function like
// Previous code
addToCartBtn.on(‘click’, function(event){
event.preventDefault();
addToCart($(this));
});
// Added code
addToCartBtn2.on(‘click’, function(event){
event.preventDefault();
addToCart2($(this));
});

3. Create another trigger function
// Previous Code
function addToCart(trigger) {
var cartIsEmpty = cartWrapper.hasClass(’empty’);
//update cart product list
addProduct();
//update number of items
updateCartCount(cartIsEmpty);
//update total price
updateCartTotal(trigger.data(‘price’), true);
//show cart
cartWrapper.removeClass(’empty’);
}

// Added code
function addToCart2(trigger) {
var cartIsEmpty = cartWrapper.hasClass(’empty’);
//update cart product list
addProduct2();
//update number of items
updateCartCount(cartIsEmpty);
//update total price
updateCartTotal(trigger.data(‘price’), true);
//show cart
cartWrapper.removeClass(’empty’);
}

4. Create a function addProduct2() after addProduct() function

//Added Code
function addProduct2() {
//this is just a product placeholder
//you should insert an item with the selected product info
//replace productId, productName, price and url with your real product info

productId = productId + 1;
var productAdded = $(‘Product 2150.00DeleteQty123456789‘);
cartList.prepend(productAdded);
}

5. Update the second product button as below

//Add To Cart

It works… If you have any problem mail to varunsai.matla@gmail.com

]]>
By: biju420 https://codyhouse.co/gem/add-to-cart-interaction/#comment-8584 Thu, 17 Nov 2016 19:54:00 +0000 https://codyhouse.co/?post_type=gem&p=14417#comment-8584 yes i also want to know how too add this in woocommerce theme

]]>
By: Conny.F https://codyhouse.co/gem/add-to-cart-interaction/#comment-8363 Wed, 12 Oct 2016 00:09:00 +0000 https://codyhouse.co/?post_type=gem&p=14417#comment-8363 Hi, have been sitting for hours trying to understand how to enable multiple products but i just don’t, im working on a phony webshop for a school project and i think im in way over my head on the js side, i’ve managed not to completely screw the js up (though i made some serious attempts at it) and still come up dry, closest to multiple products i managed to get was doubles (triples and quadruples). More in depth, when i click on the link that trigger the addProduct function it just puts everything in the basket and it only counts for one item. So i hope you can spare some time to give me some guidence for a multiple product setup, would really appreciate it. Thanks.

]]>