fetchRecentCart() {
    return this.fetch('references', `${this.config.domain}.recent-cart`).then(reference => {
      const cartId = reference.referenceId;

      return this.fetchCart(cartId);
    }).catch(() => {
      return this.createCart().then(cart => {
        const refAttrs = {
          referenceId: cart.id
        };

        refAttrs[GUID_KEY] = `${this.config.domain}.recent-cart`;

        this.create('references', refAttrs);

        return cart;
      });
    });
  }
/**
   * This method looks up a reference in localStorage to the most recent cart.
   * If one is not found, creates one. If the cart the reference points to
   * doesn't exist, create one and store the new reference.
   *
   * ```javascript
   * client.fetchRecentCart().then(cart => {
   *  // do stuff with the cart
   * });
   * ```
   *
   * @method fetchRecentCart
   * @public
   * @return {Promise|CartModel} The cart.
   */
This method looks up a reference in localStorage to the most recent cart.
If one is not found, creates one. If the cart the reference points to
doesn't exist, create one and store the new reference.



@method fetchRecentCart
@public
@return {Promise|CartModel} The cart.
This method looks up a reference in localStorage to the most recent cart . If one is not found creates one . If the cart the reference points to doesn ' t exist create one and store the new reference . @method fetchRecentCart @public @return { Promise|CartModel } The cart .
fetchRecentCart() {
    return this.fetch('references', `${this.config.domain}.recent-cart`).then(reference => {
      const cartId = reference.referenceId;
      return this.fetchCart(cartId);
    }).catch(() => {
      return this.createCart().then(cart => {
        const refAttrs = {
          referenceId: cart.id
        };
        refAttrs[GUID_KEY] = `${this.config.domain}.recent-cart`;
        this.create('references', refAttrs);
        return cart;
      });
    });
  }
fetchRecentCart ( ) { return this . fetch ( 'references' , ` ${ this . config . domain } ` ) . then ( reference => { const cartId = reference . referenceId ; return this . fetchCart ( cartId ) ; } ) . catch ( ( ) => { return this . createCart ( ) . then ( cart => { const refAttrs = { referenceId : cart . id } ; refAttrs [ GUID_KEY ] = ` ${ this . config . domain } ` ; this . create ( 'references' , refAttrs ) ; return cart ; } ) ; } ) ; }
This method looks up a reference in localStorage to the most recent cart.
This method looks up a reference in localStorage to the most recent cart .