Hooks, filters and meta keys in Product Tabs #
This reference lists the actions, filters and stored data exposed by Additional Custom Product Tabs for WooCommerce, for developers extending the plugin. Every name below is taken from the plugin source for version 1.7.5.
Actions #
| Action | Arguments | When it fires |
|---|---|---|
alg_wc_product_tabs_core_loaded |
$core (the core object) |
After the core class is constructed. Use it to hold a reference to the core instance. |
Filters #
| Filter | Arguments | Purpose |
|---|---|---|
alg_wc_product_tabs_global |
$count (int, default 1) |
Number of global (all products) custom tabs to render and to show settings for. Pro returns the value of alg_custom_product_tabs_global_total_number. |
alg_wc_product_tabs_local |
$value, $product_id |
Number of per-product custom tabs for a given product. Pro returns the product meta _alg_custom_product_tabs_local_total_number. |
alg_wc_product_tabs_local_default |
$value (int, default 1) |
Fallback per-product tab count when a product has no stored value. Pro returns alg_custom_product_tabs_local_total_number_default. |
alg_wc_product_tabs_settings |
$value, $type, $args |
Internal Pro gating filter. In the free version the “tab number” fields stay read only through this filter; Pro overrides it to make them editable. Documented for completeness. |
Note: the alg_wc_product_tabs_global, alg_wc_product_tabs_local and alg_wc_product_tabs_local_default filters are how the Pro version lifts the one-tab limit. Overriding them yourself changes how many tab slots render, but the extra global tab options are only saved when the Pro settings expose them.
Example: hold a reference to the core object #
add_action( 'alg_wc_product_tabs_core_loaded', function( $core ) {
// $core is the Alg_WC_Product_Tabs_Core instance.
// e.g. inspect $core->get_custom_tab_ids() on a product page.
} );
WooCommerce hook used by the plugin #
Product Tabs builds its tab list on the standard WooCommerce filter woocommerce_product_tabs at priority 98. If another plugin or your theme also filters product tabs, priority order decides the final result.
Per-product tab meta keys #
Per-product tabs are stored as post meta on the product. These keys are useful for imports, exports or programmatic setup. The index {i} starts at 1.
| Meta key | Stores |
|---|---|
_alg_custom_product_tabs_title_local_{i} |
Tab title |
_alg_custom_product_tabs_id_local_{i} |
Tab ID (link key) |
_alg_custom_product_tabs_priority_local_{i} |
Position (order number) |
_alg_custom_product_tabs_content_local_{i} |
Tab content |
_alg_custom_product_tabs_local_total_number |
Number of per-product tabs on this product |
Global tab option keys #
Global tabs are stored as site options, indexed by tab number {i}: alg_custom_product_tabs_title_global_{i}, alg_custom_product_tabs_id_global_{i}, alg_custom_product_tabs_priority_global_{i} and alg_custom_product_tabs_content_global_{i}, plus the show and hide options alg_custom_product_tabs_title_global_show_in_cats_ids_{i} and alg_custom_product_tabs_title_global_hide_in_cats_ids_{i} for categories, and the product variants (with _id or _sku suffixes depending on the selected input type).
Shortcodes #
The plugin registers [alg_wc_pt_product_function], [alg_wc_pt_product_meta] and [alg_wc_pt_translate] (with the deprecated alias [alg_wc_cpt_translate]). Full attribute tables are in the product tabs shortcodes reference.
Need a hand? #
For questions about extending Product Tabs, our team answers every ticket on the WPFactory support page.