Woocommerce Clear Notices When Adding to Cart

How can I call PHP WooCommerce function wc_clear_notices() whenever URL $product->add_to_cart_url() is called via AJAX?

PHP

Read More
<?php
    echo '<div class="hs_cart vc_col-sm-2">' .
        '<button url="' . $product->add_to_cart_url() . '">Add To Cart</button>' .
    '</div>';
?>

JAVASCRIPT

<script>
    $('.hs_cart button').click(function(){
        $.get($(this).attr('url'));
    });
</script>

Related posts

Leave a Reply