# How to implement rule based Pricing Rule or Price List for Attribute Based Pricing

Hi,
I have a scenario which we have been working on since a long time but never found a solution for the same, I hope some one from the community could help me out of this trouble.
The scenario is that we send some material to our supplier (sub-contracting). Now the pricing of items given by our sub-contractor are based on the item’s attribute value like Dia 2mm~5mm and Length 50~75mm and for XYZ thing he would charge 100/- and so on.

Basically the condition in terms of the fields of erpnext would be something like below:

``````IF
attribute1 = "ABC"  AND/OR attribute2 = "XYZ" AND/OR attribute3 >= 2 AND/OR attribute3 <= 5 AND/OR attribute4 >= 50 AND/OR attribute4 <= 75

Then

Purchase Price = 100/-
``````

To make matters worse we have 3 vendors for the same sub-contracting and we have to enter the purchase rate manually since we are unable to find a structure to use so that we could implement this kind of rule for automated pricing.

Now I would request the community to suggest a good way to tackle such situation should I create a Pricing Rule, Price List or a logic based on custom fields.

The first 2 options seems very cumbersome since we have like 9k items and that would mean that we have to add like 9k *3 = 27k Item prices or Pricing rules besides they would have to be added manually for the new items.

I was thinking if somehow we could add a few fields and develop a logic based on certain conditional fields then this could be achieved but the problem is that I am unable to understand that should this be in the price list table or item price or in pricing rule table.

Any suggestion?

I have a very similar problem wherein I would like to create pricing rules automatically based on the attributes of the variants. Since I had a smaller number of items, I got away with copy-pasting duplicates in Excel and changing their pricing. But I would also appreciate a long-term solution as in manufacturing a lot of costs are dependant on part attributes.