woocommerce deposit Form with AJAX and shortcode won’t update but add to previous output

Actually figured it out, it was due to the way I printed the data in the main function. Instead of simply outputting it, I placed it in a variable using ob_start and ob_get_clean. It’s all fixed and the code now becomes: //Display deposit choice and add to cart shortcode function add_product_display( $atts ) { $atts … Read more

Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin

My action was wrong in the ajax request jQuery(document).ready(function () { jQuery(“.redeem_gift_card”).click(function (e) { e.preventDefault(); jQuery.ajax({ type: “post”, dataType: “json”, url: myAjax.ajaxurl, data: { action: “gift_card_redeem” }, // not redeem_gift_card success: function (response) { if (response.type == “success”) { jQuery(“#test”).html(response.type); } else { alert(“something broke”); } }, }); }); });