Yes and no. Ofcourse you can do it, but that doesn’t mean it’s a great way to do it, or the fastest or easiest way.
You could give every barber shop its own term that has a price, but then you gain a whole host of new problems.
Instead, lets retreat to the fundamentals and rethink things.
- Post meta is for details about an individual post
- Taxonomies are for grouping, filtering, searching, querying.
So first, are the prices of services individual to a barber shop? Yes! They should be post meta
But do we want to flag barber shops as offering a service? Yes! So use a taxonomy
So now we have:
- A Barber CPT
- A taxonomy that stores which services they provide
- Each barber post has meta values that detail the price of said service at the barber shop ( also known sometimes as custom fields )
I would also recommend adding a taxonomy for how expensive the place is, e.g. when you see options such as $
,$$
,$$$
,$$$$
, or 1-10
,11-20
,etc in filters. Querying the price directly and letting the user type in an exact value is possible but very expensive and slow ( post meta is designed for fetching details about a post when you already know which post it is, taxonomies are for when you don’t know the post ).
So for example, if you have a service named “Beard trim” and the terms slug is beard-trim
, why not add a custom field named price-beard-trim
and store a price in there?