How to calculate price based on line item custom attributes

whtspc
Visitor
3 0 0

Hello there,

In my store I have a line item which contains custom attributes height and width. I would like to use the height and width to calculate the price for that line item. By default the price is calculated by simply multiplying the line item quantity by the product price, i would like it to be height multiplied by width multiplied by quantity multiplied by the product price.

Can someone help me do this? 

 

Kind regards

Replies 2 (2)

LuckyTeam
Shopify Partner
31 1 1

Hi, how do your customers select the width and height? is it through a dropdown or an input box?

banned
whtspc
Visitor
3 0 0

Hi,

They enter it through text inputs. I then add the height and width to the customAttributes object when adding the line item (I am using the storefront api)