Site

Methods for retrieving your site's configuration, such as product settings, branding, and enabled features.

read

Get the current site data which contains all of your product configurations. This method is available upon the PelcroSiteLoaded event which is triggered once the SDK has loaded the site configuration from the API call.

Example

const siteData = window.Pelcro.site.read();

// full site object
console.log(siteData);

// site products
console.log(siteData.products);

// site logo
console.log(siteData.logo);

// site has ecommerce enabled
console.log(siteData.ecommerce_enabled);

getById

Fetch the latest site data from Pelcro.

Example

window.Pelcro.site.getById((error, response) => {
  	if (error) {
    	return console.log("error", error.message);
    }
 
    const siteData = response.data;
    console.log(siteData);
})