.create   RC.Server.Wishlist.create

Create new wishlist, optionally identified by a reference name, with an optional display name.

METHOD PARAMETERS
Parameter Options Type Default Description
parameters required hashmap or POST data (none) Wishlist details. See the parameters section below for details.
options optional hashmap (none) Request options. See the options section below for details
parameters
Parameter Options Type Default Description
ref optional alpha-numeric string null Reference name for the wishlist. This is useful if you wish to have fixed number of wishlists, and be able to statically reference them. For example, if only one wishlist is needed, it can be named Default and given the reference name default. All Javascript operations can then be hard-coded in the theme to operate on that wishlist. Supplying reference name for wishlist also allows using reference names in the wishlist page URL.
name optional1 string null An optional user-friendly name for the wishlist. This will normally be used only when the website user is allowed to create wishlist.
type optional alpha-numeric string null Wishlist type. Types are used in more complex setups, to group wishlists into categories, e.g. general, re-order, etc. The name of the type must be a reference-style string, up to 20 characters long.
metafields optional any (none) Comma-separated list of metafield names to save as part of the wishlist. Each metafield must be supplied as a separate request parameter.
* optional any (none) Metafield to be added. Only considered if the name of the metafield is mentioned in the metafields parameter (see above).
options
Parameter Options Type Default Description
success optional function (none) Default success handler.
failure optional function (none) Default failure handler.
EXAMPLE
RC.Server.Wishlist.create( { ref: 'default', name: 'Default', type: 'private' }, { 
	success: function(context,html,xml) { alert('Wishlist created successfully!') }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} ); 

.update   RC.Server.Wishlist.update

Update existing wishlist details.

METHOD PARAMETERS
Parameter Options Type Default Description
ref required string or numeric (none) ID or reference name of the wishlist to update.
parameters required hashmap or POST data (none) Wishlist update parameters. Only supply parameters you wish to update. See the parameters section below for details.
options optional hashmap (none) Request options. See the options section below for details
parameters
Parameter Options Type Default Description
ref optional alpha-numeric string (none) New reference name for the wishlist. It must be unique for the session or account. Not supplying this parameter will leave the current value intact.
name optional1 string null New user-friendly name for the wishlist. This will normally be used in a website user-facing wishlist rename operation. Not supplying this parameter will leave the current value intact.
type optional alpha-numeric string null Change the type of the Wishlist. The name of the type must be a reference-style string, up to 20 characters long. Not supplying this parameter will leave the current value intact.
metafields optional any (none) Comma-separated list of metafield names to update the wishlist with. Each metafield must be supplied as a separate request parameter, if add or update behaviour is desired, and must be ommitted from the parameters (note that setting to blank / empty string is not the same) in order to be removed, if it exists.
* optional any (none) Metafield to be added or updated. Only considered if the name of the metafield is mentioned in the metafields parameter (see above).
options
Parameter Options Type Default Description
success optional function (none) Default success handler.
failure optional function (none) Default failure handler.
EXAMPLE
RC.Server.Wishlist.update( 'default', $('wishlist-update-form').serialize(), { 
	success: function(context,html,xml) { alert('Wishlist updated successfully!'); }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} ); 

.remove   RC.Server.Wishlist.remove

Remove wishlist permanently. This operation should only be allowed for wishlists created explicitly by the website user.

METHOD PARAMETERS
Parameter Options Type Default Description
ref required string or numeric (none) ID or reference name of the wishlist to be removed.
parameters required hashmap or POST data (none) Not used, could be set null or empty hashmap.
options optional hashmap (none) Request options. See the options section below for details
options
Parameter Options Type Default Description
success optional function (none) Default success handler.
failure optional function (none) Default failure handler.
EXAMPLE
RC.Server.Wishlist.remove( 'default', {}, { 
	success: function(context,html,xml) { alert('Wishlist removed successfully!'); }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} ); 

.clear   RC.Server.Wishlist.clear

Remove all items from the wishlist. This operation should normally be used behing a Clear or Remove All button.

METHOD PARAMETERS
Parameter Options Type Default Description
ref required string or numeric (none) ID or reference name of the wishlist to be cleared.
parameters required hashmap or POST data (none) Not used, could be set null or empty hashmap.
options optional hashmap (none) Request options. See the options section below for details
options
Parameter Options Type Default Description
success optional function (none) Default success handler.
failure optional function (none) Default failure handler.
EXAMPLE
RC.Server.Wishlist.clear( 'default', {}, { 
	success: function(context,html,xml) { alert('Wishlist cleared successfully!'); }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} ); 

.copyToCart   RC.Server.Wishlist.copyToCart

Copy all items from the wishlist into the shopping cart. You can implement a move behaviour by executing a copy followed by clear.

METHOD PARAMETERS
Parameter Options Type Default Description
ref required string or numeric (none) ID or reference name of the wishlist to copy the items from.
parameters required hashmap or POST data (none) Not used, could be set null or empty hashmap.
options optional hashmap (none) Request options. See the options section below for details
options
Parameter Options Type Default Description
success optional function (none) Default success handler.
failure optional function (none) Default failure handler.
EXAMPLE
RC.Server.Wishlist.copyToCart( 'default', {}, { 
	success: function(context,html,xml) { alert('Wishlist items copied to cart!'); }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} ); 

.copyToWishlist   RC.Server.Wishlist.copyToWishlist

Copy all items from the wishlist into another wishlist. You can implement a move behaviour by executing a copy followed by clear, and merge operation by executing a copy followed by remove.

METHOD PARAMETERS
Parameter Options Type Default Description
ref required string or numeric (none) ID or reference name of the wishlist to copy the items from.
ref required string or numeric (none) ID or reference name of the wishlist to copy the items to.
parameters required hashmap or POST data (none) Not used, could be set null or empty hashmap.
options optional hashmap (none) Request options. See the options section below for details
options
Parameter Options Type Default Description
success optional function (none) Default success handler.
failure optional function (none) Default failure handler.
EXAMPLE
RC.Server.Wishlist.copyToWishlist( 'default', 'another', {}, { 
	success: function(context,html,xml) { alert('Wishlist items copied to wishlist!'); }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} ); 

.add   RC.Server.Wishlist.Item.add

Add item to wishlist.

METHOD PARAMETERS
Parameter Options Type Default Description
ref required string or numeric (none) ID or reference name of the wishlist to add the item to. If a reference name is specified, and wishlist with such name doesn't exist, the wishlist will be created automatically. This is useful when implementing websites with single wishlist, a static reference name can be used for all Wishlist.Item.* calls.
parameters required hashmap (none) The product identification and quantity to be added to the wishlist. See the parameters section below for details.
options optional hashmap (none) Request options. See the options section below for details
parameters
Parameter Options Type Default Description
productId required numeric (none) The product ID of the product to add to the wishlist.
This will normally by the output from {{ product.id }} template fragment.
variantId required 1 numeric null The product variant ID of the product variant to add to the wishlist.
This will normally by the output from {{ variant.id }} template fragment.
customizationId optional numeric null The product customization ID.
kitId optional numeric null The product kit ID.
quantity 2 optional numeric 1 The quantity to add. If not specified, quantity of 1 is used by default.
options
Parameter Options Type Default Description
post optional hashmap or POST data (none) Additional item-related information to be saved with the item. See post section below for more information.
success optional function (none) Default success handler.
failure optional function (none) Default failure handler.
post
Parameter Options Type Default Description
quantity 2 optional numeric 1 The quantity to add. If not specified, quantity of 1 is used by default.
notes optional string (none) Notes related to the item.
metafields optional string (none) Comma-separated list of metafield names posted with this add request. For example, if there is an option for Gift Packaging and Gift Card, using input names gift-packaging and gift-card respectively, then the metafield has to be set to gift-packaging,gift-card.
  • 1 Only applies to products with variants.
  • 2 Quantity can be specified as parameter or as a post field (when submitting it from a form, for example). The later takes precedence, if both are specified. If none are specified, quantity of 1 is used.
EXAMPLE
RC.Server.Wishlist.Item.add( 'default', { productId: {{ product.id }} }, { 
	post: $('#add-to-wl-{{ product.id }}').serialize(), 
	success: function(context,html,xml) { alert('Product added to wishlist successfully!'); }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} ); 

.update   RC.Server.Wishlist.Item.update

This method can update the quanitty, notes and customization data for a single wishlist item, identified by its item ID, or update only quantities across all wishlist items in a single submit.

METHOD PARAMETERS
Parameter Options Type Default Description
ref required string or numeric (none) ID or reference name of the wishlist to update item(s) into.
parameters required hashmap (none) The item identification and new quantity to be set. See the parameters section below for details.
options optional hashmap (none) Request options. See the options section below for details
parameters
Parameter Options Type Default Description
itemId 2 required numeric (none) The item ID of the wishlist item.
This will normally by the output from {{ item.id }} template fragment.
quantity 1 required 2 numeric (none) The new quantity to set.
options
Parameter Options Type Default Description
post optional hashmap or POST data (none) Additional item-related information to be saved with the item. See post section below for more information.
success optional function (none) Default success handler.
failure optional function (none) Default failure handler.
post
Parameter Options Type Default Description
item_{id}_quantity 3 required numeric (none) The quantity to add. If not specified, quantity of 1 is used by default.
quantity 1 required 2 numeric 1 The quantity to add. If not specified, quantity of 1 is used by default.
notes 1 optional string (none) Notes related to the item.
  • 1 Applicable to single-item updates only.
  • 2 Quantity can be specified as parameter or as a post field (when submitting it from a form, for example). The later takes precedence, if both are specified.
  • 3 Applicable to multi-item updates only.
EXAMPLE (SINGLE ITEM UPDATE)
RC.Server.Wishlist.Item.update( 'default', { itemId: {{ item.id }}, quantity: 4 }, { 
	success: function(context,html,xml) { alert('Wishlist item updated successfully!'); }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} ); 
EXAMPLE (MULTI-ITEM UPDATE)
RC.Server.Wishlist.Item..update( 'default', {}, { 
	post: $('wishlist-form').serialize(), 
	success: function(context,html,xml) { alert('Wishlist items updated successfully!'); }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} ); 

.remove   RC.Server.Wishlist.Item.remove

Removes single wishlist item, identified by its item ID, from the specified wishlist.

METHOD PARAMETERS
Parameter Options Type Default Description
ref required string or numeric (none) ID or reference name of the wishlist to remove an item from.
parameters required hashmap (none) The item identification. See the parameters section below for details.
options optional hashmap (none) Request options. See the options section below for details
parameters
Parameter Options Type Default Description
itemId required numeric (none) The item ID of the wishlist item.
This will normally by the output from {{ item.id }} template fragment.
options
Parameter Options Type Default Description
success optional function (none) Default success handler.
failure optional function (none) Default failure handler.
EXAMPLE (SINGLE ITEM UPDATE)
RC.Server.Wishlist.Item.remove( 'default', { itemId: {{ item.id }} }, { 
	success: function(context,html,xml) { alert('Wishlist item removed successfully!'); }, 
	failure: function(context,errorMsg,xml,XHR) { alert(errorMsg); } 
} );