Skip Navigation

[Resolved] Reusable fields in different CPTs

This support ticket is created 2 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by georgeY-3 2 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#2512407

Tell us what you are trying to do?

I have pre-made products that have different attributes like paint colors and stain colors for trim and for siding. Trim can have either a paint color or a stain color. Siding is the same. We have this setup on multiple product types like chicken coops, dog kennels, screen rooms... How could I best represent this in Toolset? I know in WooCommerce attributes are taxonomies, but the conditional nature of our paint and stain options doesn't seem to work well with taxonomies. Additionally, we have a hex color code associated with each paint and stain color that we would like to use to show the color on screen in filters and in views/templates. I need some advice on how to organize this data.

I thought about using a CPT for the paint colors. Or perhaps using CPTs for the trim and siding, but since the colors are the same for both I'd like to not have to have duplicates of the same colors in both. Would I want to have CPTs for both with relationships?

Is there any documentation that you are following?

I searched and didn't find topics similar enough to this issue to help me.

Is there a similar example that we can see?

dev.omrto.com/product/chicken-coop has a WooCommerce product with the above options as well as others. This is a "build-your-own" configurator. It will be separate from already created inventory, but the existing inventory will have all the same attributes.

I'm trying to recreate the search nearest location option so I can display current inventory above the build your own section to encourage people to buy something already built.

#2513605

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

What if you think of "paint colors" as custom post type and then add repeating field group as "rfg-trim-siding" and to this repeating field group you should add field that should hold the hex color code and another radio button field that should have options like:
- trim
- siding
- both

What you think does that will help?

More info:
- https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/

#2514085

That's an interesting idea. I was looking at this as well. I will try adding the paint colors, stain colors and metal colors as 3 different field groups with a radio button that has the hex code as its value, then display them only on the correct post types. I'll let you know if it works.
https://toolset.com/lesson-placement/lesson-placements-1824625-1840755/#conditionally-display-a-group-of-custom-fields

#2514295

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

ok for sure - please let me know if you require further assistance.

#2516453

My issue is resolved now. Thank you!