Add a gift wrapping option in the Boundless theme for the slide out cart

Salim003
New Member
2 0 0

I'm working in the Boundless theme, and I want to add a gift wrapping option with a checkbox in the slide out cart on the right of the home page. I've got the checkbox and am able to add to the cart but only when i refresh the page. Here's my code below to add to the cart:

  <script>
    /*6590925701297*/
    function giftWrapping(){
      jQuery.post('/cart/add.js', 
      {
        items: [	
          {
            quantity: 1,
            id: 39394015510705
          }
        ]
      });
    alert("Updated jQuery");
    }     
  </script>

Is there a way to add the item to the cart in realtime without having to refreshing the page? Heres the gift wrapping option I'm referencing (https://shopify.dev/tutorials/customize-theme-add-gift-wrap-option).

 

0 Likes