Set Relative Path URL



This function is only compatible with Magento-based storefronts (Magento 1 & Magento 2).


By default, some Swell API calls communicate with your store's domain up to the top-level domain.

For example, in the URL:, Swell API requests may only be sent to and ignore any URL path following the top-level domain - in this case /store.

If your implementation requires API requests to be sent to a specific domain that includes a URL path/slug, you must inform the Swell API that these requests should be directed towards the specific path by calling the swellAPI.setPathPrefix(pathPrefix) function.

To do so, Set the URL path within the parenthesis following swellAPI.setPathPrefix
For example, should look like the example below.

$(document).on("swell:initialized", function() {