Home › Forums › General Issues › Need some help with CPT relationships
Hey all, I am working on creating a product datebase for my photography page. The current ecommerce options don’t really meet my needs so I’m trying to create my own.
I have created a few custom post types, and I am working on building the custom fields that contain the desired information. But I don’t really understand how to link everything.
So the way I have my prices set up for my products, I have a CPT called multipliers, which will allow me to enter the general commission I expect to receive for each product group. Each multiplier will be calculated based on one of five formulas.
I also have a taxonomy called collections. So each collection may contain several sub groups. So If I have a collection called Wall prints, a sub group may be Canvas which may have its own sub group of .75 thickness, which then contains many product sizes.
So my Multiplier CPT will have inputs for 3 different price ranges (High, low, and medium) This is so I can assign friends and family a different rate than normal clients. It will also have a selection box with different multiplier types. For example, some prices are determined by the area of the product, some are determined by a flat commission, and others are determined by a multiple of COGS.
In the multiplier CPT, I will also select the product grouping it belongs too with the collection taxonomy.
There was also a pre included CPT for vendors that I added a few custom fields for.
And finally my products CPT. This is where I need to have some information selected and calculated based on inputs.
So for each product, I will enter the product title in the standard title bar. A description if available in the content area, then I want to be able to select from my list of venders, and also the the corresponding Multiplier group for that product. If I’m entering a canvas print, I will select the .75 inch width which has the corresponding parent pages of canvas prints> then Wall Prints.
Lastly I will enter Area and COGS.
When I update I would like this to calculate the High, Medium and Low prices based on the Multiplier selection.
So I suppose the question is, where do I enter the code that pulls and calculates these values based on the criteria selected and entered on both post types, so that it displays in a searchable chart on the front and back end based on collection and product group selected?
Each client will be assigned price group (High, medium and Low), so when they log in, prices will be custom to them.
So when they browse my products, they will first choose product collection (9 options) that will display the product groups (Paper prints, canvas prints, ect), then it displays the various sizes for each which will list the calculated price next to the product size.
After I get this figured out, I’ll have to figure out how to add it to a shopping cart.
If anyone can help me figure out how to make this work, It would be greatly appreciated. Thanks
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We demoed ACF 6.1 Beta during the most recent session of ACF Chat Fridays, highlighting the new ability to regenerate and clear labels, setting the Admin Menu Parent as a slug, and more. Catch the video replay in our latest summary. https://t.co/rHEpPVas64 pic.twitter.com/hB1XKTexXi— Advanced Custom Fields (@wp_acf) March 23, 2023
© 2023 Advanced Custom Fields.