If user updates their cart and already have an ongoing checkout. Use the update checkout to update the current checkout instead of creating a new one. You can re-use the getIframe method but the content will to some extent be different.

//SERVER SIDE Code to update checkout
$updateCheckoutAPIAddress = "http://sandbox.hygglig.com/Checkout/api/Checkout/UpdateOrder";
$updateCheckoutCheckSum = (SHA1($totalAmount . $secret));
$exampleArray = array(
   'MerchantKey' => $key,
   'Token' => $hyggligTokenFromCurrentCheckout,
   'Articles' => array(
      'Articles' => array(
         array(
         'ArticleName' => 'Hygglig Artikel',
         'ArticleNumber'=>'1',
         'Description'=>'En fantastisk artikel från Hygglig',
         'Price'=>'15000',
         'Quantity'=>'400',
         'VAT'=>'2500',
      ),
      array(
         'ArticleName' => 'Frakt',
         'ArticleNumber'=>'999',
         'Description'=>'Fraktsätt: Hyggligt',
         'Price'=>'15000',
         'Quantity'=>'100',
         'VAT'=>'2500'
      ),
   )
);
//CLIENT SIDE Javascript Update Checkout Example
function updateCheckout() {
   $.ajax({
      url: '/DoUpdate',
      //Token = "c" value of iFrame src
      data: { 'Token': '20E03C0581F0C7FB52578EF88B4F620612B6DF57' },
      type: 'POST',
      success: function (data) {
         //Calls update function in iFrame
         _hyggligCheckout.updateHygglig();
      },
      error: function () {
         alert('Error occured');}
   });
}

Use our demo shop to get an idea of how it can look

Go ahead – add a product and go to checkout.
Test the update function by changing shipping option.