Need to display cart weight on BigCommerce Stencil Cornerstone cart template
$30-250 USD
Avslutat
Publicerad ungefär fyra år sedan
$30-250 USD
Betalning vid leverans
Currently, there is no readily available variable to retrieve the current cart weight or even individual product weights on the cart page in BigCommerce's Cornerstone theme (built with Stencil). We need to somehow tap into the BigCommerce Storefront API (documentation available) and use the IDs of the items in the cart to feed to the API to pull out the weight of each individual product. From there we can calculate the total cart weight.
Preferred experience using Stencil and BigCommerce's Stencil Utils ([login to view URL]). I believe you would have to use these with callback functions in order to tap into the products and retrieve the weights. Further, I would prefer the script to run in the [login to view URL] method that fires when the cart updates. (So if a user increases/decreases quantity or removes a product, the weight would recalculate). Also, I don't have any project files directly for you to use, I can make due with your code added to BigCommerce's default Cornerstone theme. If you've used Stencil I'm sure you ran into this before ([login to view URL]).