grofftech / custom-types
A WordPress plugin for adding custom types
Package info
gitlab.com/grofftech/wordpress/custom-types
Type:wordpress-plugin
pkg:composer/grofftech/custom-types
Requires
- php: >=8.1.0
- php-di/php-di: 7.0.11
Requires (Dev)
- brain/monkey: 2.6.2
- phpunit/phpunit: 10.5.48
- wp-coding-standards/wpcs: 3.2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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.