I'm adding items to the cart via a custom plugin and everything works as i need it to, however the mini cart does not update and i can't seem to trigger a refresh. Here is a piece of my code for reference:
javascript: jQuery.ajax({
url: '/result/',
data:{post_title:title, post_content:detail,price:price,quantity:quantity},
success:function (data_rdx) {
jQuery(".fr-loading").hide();
if(data_rdx=='fail') {
alert("Error, Please Try Again");
} else {
jQuery(".orb_custom").html(data_rdx);
//trigger mini-cart refresh
alert('Cart Updated');
}
}});
I've tried adding a small ajax post with wc-ajax=get_refreshed_fragments
but it doesn't seem to work. What would be the easiest way to trigger a refresh?
Thank you.
jQuery(document.body).trigger('wc_fragment_refresh');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.