How to add specific terms in a custom post type?

I am creating a dedicated WordPress ecommerce website without using WooCommerce for myself. I created the custom post type called 'products' but now I am stuck on how to add specific terms like SKU, price, variations, short description, and related products section in it.

Can you please help me know. I don't know if I can specifically make sections to update such terms in the product post type.

Topic custom-post-type-archives functions e-commerce php custom-post-types Wordpress

Category Web


The easy way?

Just use Custom Post Type UI to create custom taxonomies (in your case: SKU, price, variations, short description, and related products).

And for the admin page, use ACF to add meta boxes to your products edit screen.

That's what I did. Then you can concentrate to other matters.


I think you should save this data in post_meta.
These values are part of every single product post and are different in every product.
You can add custom input fields with add_meta_box() function in the hook add_action('add_meta_boxes', 'my_custom_metaboxes'); for example.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.