How can I display the total value of inventory on a collection page?

Hi,

I’m setting up a collection page for a wholesale client that wishes to see the total value of all the inventory for an item.

I am therefore looking to add on the collection page below each product name and price a total value for price times inventory number.

What code would I need to add to do this?

The collection page url - https://www.776bc.com/collections/rowing-australia-warehouse-stock

Thanks.

Hi,

I think you are looking for something like this:

{% capture total_value %} {{ product.first_available_variant.inventory_quantity | times: product.first_available_variant.price | money }} {% endcapture %}

And then you can print the text with:

{{ total_value }}

Note that this code probably won’t work with multiple variants.

Thanks! Would there be anyway to have it working for products with multiple variants?