Beautiful apps for Shopify

Appmate JS Toolkit

The Appmate Toolkit is a Javascript package, which helps you implementing our apps into your theme. The toolkit is referenced by the global variable 'Appmate'.

Global Methods

Appmate.init

This method configures your Appmate toolkit. You should pass a configuration object when calling this method.

Appmate.init({
  shop: {
    domain: '{{ shop.domain }}'
  },
  session: {
    customer: '{{ customer.id }}'
  }
});

Global Properties

Appmate.globals

Reference to the globals configuration object.

Appmate.filters

A convenience method to access the Appmate's Liquid filters.

var imageUrl = Appmate.filters.img_url(variant, 'medium');
Appmate.version

Version of the Appmate toolkit you are currently using.

Wishlist King Methods

Appmate.wk.on

Use this method to configure event handler for Wishlist King.

Appmate.wk.addProduct

Call this method to add a product to the wishlist. You must pass the product id and can optionally pass the selected variant id. This method returns a [Promise][mozilla-promise].

Appmate.wk.addProduct(productId, variantId)
.then(function(){
  console.log('Product added to wishlist.');
})
.catch(console.error);
Appmate.wk.clear

Clears the current wishlist. This method returns a [Promise][mozilla-promise].

Appmate.wk.clear()
.then(function(){
  console.log('Wishlist is now empty.');
})
.catch(console.error);
Appmate.wk.getItem

Use this method to get a product from the wishlist by its wishlist item id. This method returns a [Promise][mozilla-promise].

Appmate.wk.getItem(itemId)
.then(function(product){
  console.log(product);
});
Appmate.wk.getProduct

Use this method to get a product from the wishlist by its product id.

var product = Appmate.wishlist.getProduct(variant.product_id);
Appmate.wk.removeItem

Removes a wishlist item from the current wishlist. You must pass the wishlist item id. This method returns a [Promise][mozilla-promise].

var itemId = element.getAttribute('data-wishlist-item');

Appmate.wk.removeItem(itemId)
.then(function(){
  console.log('Item removed from wishlist.');
})
.catch(console.error);
Appmate.wk.toggleProduct

This is a convenience method to add or remove a product. The product get's added if it is not yet in the wishlist and removed otherwise. You must pass the product id and can optionally pass the selected variant id. This method returns a [Promise][mozilla-promise].

Appmate.wk.toggleProduct(productId, variantId)
.then(function(){
  console.log('Product toggled.');
})
.catch(console.error);
Appmate.wk.updateItem

This method updates a products selected variant. You have to add the product to the wishlist before using this method. You must pass the wishlist item id as well as the selected variant id. This method returns a [Promise][mozilla-promise].

Appmate.wk.updateItem(itemId, {selected_variant_id: variantId});
Appmate.wk.moveToCart

This method updates removes an item from the wishlist and adds it to the cart. You must pass the wishlist item id as well as the order form data as a serialised string. This method returns a [Promise][mozilla-promise].

Appmate.wk
.moveToCart(item, formData)
.then(function(){
  window.scrollTo(0, 0);
  location.reload();
});