Reputation: 23
Is there any way to access a product with variations/options individual weight? Currently have an old script pulling a basic product (no variations/options) through custom fields. Now I have products with variations all with different weights, so the custom fields solution no longer works...
Ideally I want to pull the product options weight to add to my script to total the cart's weight. Tried ?debug=context at the end of a localhost URL and could not find product option weight to be available on the cart page- are there other options to work around this??
I am on BigCommerce Cornerstone theme
Upvotes: 1
Views: 209
Reputation: 376
From what I understand by reading your post, the best way to accomplish your goal will be with the storefront GraphQL API. Using GraphQL you can query each product in the cart and include the variant data with the weight. This will allow you to get the weight for all of the variants in the order and add them up to get the total.
I'd definitely suggest checking out the BigCommerce GraphQL Documentation for more information, as well as the Code Examples.
Upvotes: 1