Created
February 14, 2020 11:04
-
-
Save iamsathyaseelan/39171fa010792e1a8e33e308a86cd522 to your computer and use it in GitHub Desktop.
changes mage in https://tatararazors.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp-content/themes/tatara/js/ajax.js | |
Line number : 12 | |
Original: | |
========= | |
if (response) { | |
setTimeout(function () { | |
$('.cart_popup').html(response); | |
}, 500); | |
} | |
Edited: | |
======== | |
if (response) { | |
setTimeout(function () { | |
$('.cart_popup').html(response); | |
$( document.body ).trigger( 'added_to_cart', [ response ] ); | |
}, 500); | |
} | |
Line number : 39 | |
Original: | |
========= | |
if (response) { | |
setTimeout(function () { | |
$('.cart_popup').html(response); | |
}, 500); | |
} | |
Edited: | |
======= | |
if (response) { | |
setTimeout(function () { | |
$('.cart_popup').html(response); | |
$( document.body ).trigger( 'added_to_cart', [ response ] ); | |
}, 500); | |
} | |
Line number 119 | |
Original: | |
========= | |
setTimeout(function () { | |
$('.cart_popup').html(response); | |
$('.add_to_card').removeClass('added_card'); | |
$('.add_to_card').find('.add_btn').text('add to cart'); | |
}, 500); | |
Edited: | |
======== | |
setTimeout(function () { | |
$('.cart_popup').html(response); | |
$('.add_to_card').removeClass('added_card'); | |
$('.add_to_card').find('.add_btn').text('add to cart'); | |
$( document.body ).trigger( 'added_to_cart', [ response ] ); | |
}, 500); | |
wp-content/themes/tatara/js/custom.js | |
following script added to the end of the file: | |
/* | |
* Created by retainful developer | |
* Woocommerce triggers were unable to capture, so on each fage refresh, just trigger "wc_fragments_refreshed" after 3 sec | |
* this is to solve the cart syncing issue | |
*/ | |
setTimeout(function () { | |
$(document.body).trigger('wc_fragments_refreshed'); | |
},3000); | |
$(document.body).on('added_to_cart',function(event,response){ | |
$.ajax({ | |
type: 'POST', | |
url: retainful_cart_data.ajax_url, | |
data: { | |
'action': 'rnoc_track_user_data' | |
}, | |
success: function (response) { | |
if (response) { | |
if (response.success && response.data) { | |
syncRetainfulCart(response.data); | |
} | |
} | |
} | |
}); | |
}); | |
function syncRetainfulCart(data){ | |
let headers = {"app_id": retainful_cart_data.public_key, "Content-Type": "application/json"}; | |
let body = {"data": data}; | |
$.ajax({ | |
url: retainful_cart_data.api_url, | |
headers: headers, | |
method: 'POST', | |
dataType: 'json', | |
data: body, | |
async: true, | |
success: function (response) { | |
msg = response; | |
}, | |
error: function (response) { | |
msg = response; | |
} | |
}); | |
} | |
wp-content/themes/tatara/functions.php | |
line number : 84 and 85 | |
Original: | |
========= | |
wp_enqueue_script('script-11', get_template_directory_uri() . '/js/custom.js', array(), '1.0.2', true); | |
wp_enqueue_script('script-12', get_template_directory_uri() . '/js/ajax.js', array(), '1.0.0', true); | |
edited: | |
======= | |
wp_enqueue_script('script-11', get_template_directory_uri() . '/js/custom.js', array(), '1.0.3', true); | |
wp_enqueue_script('script-12', get_template_directory_uri() . '/js/ajax.js', array(), '1.0.1', true); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment