Skip to content

Instantly share code, notes, and snippets.

View anderly's full-sized avatar

Adam Anderly anderly

View GitHub Profile
@anderly
anderly / woocommerce-add-custom-product-data-tab.php
Last active June 8, 2023 20:30
WooCommerce - Add Custom Product Data Tab
// First Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter
add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' );
function add_my_custom_product_data_tab( $product_data_tabs ) {
$product_data_tabs['my-custom-tab'] = array(
'label' => __( 'My Custom Tab', 'my_text_domain' ),
'target' => 'my_custom_product_data',
);
return $product_data_tabs;
}
@anderly
anderly / CacheService.cs
Last active January 27, 2024 20:54
MediatR Caching Pipeline Behavior
public class CacheService : ICache
{
private readonly string _keyPrefix;
private readonly IDistributedCache _cache;
private readonly IConfiguration _config;
public CacheService(IDistributedCache cache, IConfiguration config)
{
_cache = cache;
_config = config;