Skip to content

Commit

Permalink
Prevent double add to cart with related products
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Jun 4, 2012
1 parent 7f6970c commit 439d21e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions assets/js/woocommerce.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jQuery(document).ready(function($) {
// Ajax action
$.post( woocommerce_params.ajax_url, data, function(response) {

var this_page = window.location.toString();

this_page = this_page.split("?")[0];

$thisbutton.removeClass('loading');

// Get response
Expand Down Expand Up @@ -54,7 +58,7 @@ jQuery(document).ready(function($) {

// Cart widget load
if ($('.widget_shopping_cart').size()>0) {
$('.widget_shopping_cart:eq(0)').load( window.location + ' .widget_shopping_cart:eq(0) > *', function() {
$('.widget_shopping_cart:eq(0)').load( this_page + ' .widget_shopping_cart:eq(0) > *', function() {

// Replace fragments
if (fragments) {
Expand All @@ -81,7 +85,7 @@ jQuery(document).ready(function($) {
}

// Cart page elements
$('.shop_table.cart').load( window.location + ' .shop_table.cart:eq(0) > *', function() {
$('.shop_table.cart').load( this_page + ' .shop_table.cart:eq(0) > *', function() {

$("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass('buttons_added').append('<input type="button" value="+" id="add1" class="plus" />').prepend('<input type="button" value="-" id="minus1" class="minus" />');

Expand All @@ -90,7 +94,7 @@ jQuery(document).ready(function($) {
$('body').trigger('cart_page_refreshed');
});

$('.cart_totals').load( window.location + ' .cart_totals:eq(0) > *', function() {
$('.cart_totals').load( this_page + ' .cart_totals:eq(0) > *', function() {
$('.cart_totals').css('opacity', '1').unblock();
});

Expand Down
Loading

0 comments on commit 439d21e

Please sign in to comment.