How to get sidebar-Cart to expand after successfully adding goods?

New Member
1 0 0

I created an Add to Cart button. After the goods are added successfully, there is no item in the shopping cart and it needs to be refreshed. Besides, the sidebar-Cart will not be expanded

this is code:

<script type="text/javascript">
   $("#section-{{ }} input[type='radio']").each(function(){
        var data=$(this).attr("data-variant")
        var imgurl=$(this).attr("data-image-url")
        var url = imgurl.replace(/_{width}x/ig, '')
function addItemToCart(variant_id, qty) {
    var data = {
      "id": variant_id,
      "quantity": qty

      type: 'POST',
      url: '/cart/add.js',
      data: data,
      dataType: 'json',
      success:function() { 
        alert("Thank You! The Product Was added to the Cart Successfully.");

$('#section-{{ }} .yyz-button-btn').each(function(){
Replies 0 (0)