Big Commerce - Seller Ratings - Script Manager Automated Review Collectrion

If you utilize a heavily customized Big Commerce theme that restricts access to theme files, use this implementation.

This method of implementation will allow you to capture the product catalog and install our product review widget without editing any theme files. This will decrease the chance of having to re-implement the ResellerRatings code once a theme is updated.

 

From the BigCommerce Dashboard, click on storefront and then script manager. Follow the settings below and paste the script into the script manager.

 

 

<script>
var _rrPR = {
seller_id: XXXXXX,
auto: false,
invoice:{{checkout.order.id}}
};
fetch('/api/storefront/order/{{checkout.order.id}}', {
credentials: 'include'
}).then(function (response) {
return response.json();
}).then(function (myJson) {
if(myJson.lineItems && myJson.orderId)
{
skus = [];
var RR_phys_items = myJson.lineItems.physicalItems;
for(var phys_inc = 0; phys_inc < RR_phys_items.length; phys_inc++)
{
skus.push(RR_phys_items[phys_inc].sku);
}
var RR_dig_items = myJson.lineItems.digitalItems;
for(var dig_inc = 0; dig_inc < RR_dig_items.length; dig_inc++)
{
skus.push(RR_dig_items[dig_inc].sku);
}
_rrPR.sku = skus;
_rrPR.email = myJson.billingAddress.email;
(function() {
var s=document.createElement('script');s.type='text/javascript';
s.async=true;
s.src="https://www.resellerratings.com/popup/include/load.js";
var ss=document.getElementsByTagName('script')[0];
ss.parentNode.insertBefore(s,ss);
})();
}
});
</script>