Hi,
Iām trying to get the variant data by the product slug (which will be the product page params) and combined variant options from the product page query params (the āunifiedā field represented as a single string).
Please see below my naive attempt to filter the variants associated with a particular product.
How would you recommend I go about this?
let productWithFilteredVariants = {
...response.data.product,
filteredVariants: response.data.product.variants.filter(variant => variant.unified === 'Sizes')
}
// optional, just to remove the unfiltered `variants` for clarity
delete(productWithFilteredVariants.variants)
Ah, ok. Thank you Roger. Iāve reworked my schema so that variants consume products rather than the other way round. Variants can then consume a computed string field (using the great plugin) of the product slug field. If any of that makes sense to anyone looking for a possible workaround in the future.