BigCommerce custom fields

This commit is contained in:
Catalin Pinte
2022-11-28 16:47:45 +02:00
parent f4a7b7255e
commit 15928abe12
7 changed files with 316 additions and 21 deletions

View File

@@ -83,8 +83,8 @@ export const getMetafieldValue = (
case 'weight':
return getMeasurment(value, locale)
case 'rating':
const { scale_max, value: val } = JSON.parse(value)
return Array.from({ length: scale_max }, (_, i) =>
const { scale_max: length, value: val } = JSON.parse(value)
return Array.from({ length }, (_, i) =>
i <= val - 1 ? '&#9733;' : '&#9734;'
).join('')
case 'color':