grofftech/custom-types

A plugin for adding custom types to WordPress

1.0.0 2025-07-27 11:23 UTC

This package is auto-updated.

Last update: 2025-07-27 15:26:30 UTC


README

Helps facilitate code required for custom types in WordPress

WooCommerce

Custom Product

There are actions and filters to hook into that allow for the creation of a custom product in WooCommerce, including adding the type, and creating and saving custom fields

Actions

ct_create_product_class - Include the class file that extends WC_Product

ct_add_product_custom_fields - Add custom fields for the product

ct_save_product_custom_fields - Save data for the product custom fields

ct_add_product_custom_fields_for_shipping - Add custom fields to the shipping tab. Saving data for these fields would happen in the ct_save_product_custom_fields action

Filters

ct_get_product_class - Gets the class name from the ct_create_product_class action. Two filter callback arguments required, $class and $product_type. Hook filters the $class argument.

ct_add_product_selection - Adds the product to be able to be selected. One filter callback argument required, $types.

ct_update_product_tabs - Updates the tabs when the product is selected. One filter callback argument required, $tabs

Custom Shipping

Filters

ct_add_custom_shipping_method - Adds a custom shipping method. One filter callback argument required, $methods

ct_update_custom_shipping_method_label - Updates the display label for the custom shipping method added. Two filter callback arguments required, $label and $method. Hook filters the $label argument.