I have a custom button on my checkout page, after which I add the product to the cart through AJAX.
JS:
$('#add_domain_product').on('click', function() { $.ajax({ url: Ajax.ajaxurl, type: "POST", data: { action: 'add_domain_product', }, success: function (data, status, xhr) {
PHP:
add_action('wp_ajax_add_domain_product', 'bs_add_domain_product'); function bs_add_domain_product() { global $woocommerce; $woocommerce->cart->add_to_cart('633'); exit(); }
After that I will need to update the order overview, so it will also display my newly added product. How can i do this?
source share