update_order_review( ) on button click

前端 未结 2 2133
离开以前
离开以前 2021-02-15 05:39

I have a custom button on my checkout page, on click I\'m adding a product to cart via AJAX.

JS:

$(\'#add_domain_product\').on(\'click\', function() {
          


        
相关标签:
2条回答
  • 2021-02-15 05:47

    In Checkout page:

    jQuery(document.body).trigger("update_checkout")
    

    In Cart page:

    jQuery(document.body).trigger("wc_update_cart");
    
    0 讨论(0)
  • 2021-02-15 06:00

    All you need to do is call a trigger on the body to update the cart.

    $( 'body' ).trigger( 'update_checkout' );
    

    This will automatically call all the subsequent AJAX calls needed to refresh the cart information, including the order review.

    0 讨论(0)
提交回复
热议问题