Skip to content

Instantly share code, notes, and snippets.

View joshuatf's full-sized avatar

Joshua T Flowers joshuatf

  • Automattic
  • San Diego, CA
View GitHub Profile
@joshuatf
joshuatf / product-template-extensibility.php
Last active July 14, 2023 02:18
Product template extensibility
<?php
/**
* Plugin Name: Test Plugin
* Author: Joshua Flowers
* Version: 0.1.0
*/
function test_plugin_modify_product_template() {
$template_registry = Automattic\WooCommerce\Admin\Features\ProductBlockEditor\ProductTemplates\ProductTemplateRegistry::get_instance();
$simple_template = $template_registry->get_registered( 'simple' );
@joshuatf
joshuatf / disable-woocommerce-admin.php
Created March 11, 2020 09:44
A plugin to disable the new WooCommerce Admin package in WooCommerce
<?php
/**
* Plugin Name: Disable WooCommerce Admin
* Description: This plugin disables the new WooCommerce Admin package in WooCommerce.
* Version: 1.0
*/
add_filter( 'woocommerce_admin_disabled', '__return_true' );
@joshuatf
joshuatf / array_utils.rb
Created May 24, 2018 13:48
ArrayUtils - Array flattener
require 'rspec'
# Utils for flattening an array recursively
# Usage: ArrayUtils.new(array_to_flatten).flatten
class ArrayUtils
def initialize(array)
raise 'Must be initialized with an array' unless array.kind_of? Array
@array = array
end