BigCommerce - Product Review Integration - Review Collection

BigCommerce - Product Review Integration - Review Collection Kevin Miller

I. In the BigCommerce dashboard, open the storefront tab and open script manager to create a new script

II. Set the script to open on the order confirmation page and the script type to script

III. In script contents, paste the following and replace YOUR_SELLER_ID with your ResellerRatings SellerID


<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>
{% enraw %}

 


IIII. Click Save



Did this answer your question?