Skip to content

Instantly share code, notes, and snippets.

View adrianduffell's full-sized avatar
:octocat:
I may be slow to respond.

Adrian Duffell adrianduffell

:octocat:
I may be slow to respond.
View GitHub Profile
@adrianduffell
adrianduffell / disable-woocommerce-coming-soon-mode.php
Last active August 12, 2024 04:40
Disable WooCommerce coming soon mode
<?php
/*
* Plugin Name: Disable WooCommerce coming soon mode
* Author: Adrian Duffell
* Description: Automatically disables coming soon mode in WooCommerce.
* Version: 1.0.0
*/
add_filter('pre_option_woocommerce_coming_soon', 'opt_out_woocommerce_coming_soon');
@adrianduffell
adrianduffell / usage-tracking-opt-out.php
Created July 24, 2024 08:29
WooCommerce usage tracking opt-out
<?php
/*
* Plugin Name: WooCommerce usage tracking opt-out
* Author: Adrian Duffell
* Description: Automatically opts-out of usage tracking in WooCommerce. https://woocommerce.com/usage-tracking/
* Version: 1.0.0
*/
add_filter('pre_option_woocommerce_allow_tracking', 'opt_out_woocommerce_tracking');
@adrianduffell
adrianduffell / functions.php
Created June 19, 2024 00:01
Exclude user role from coming soon protection
<?php
add_filter( ‘woocommerce_coming_soon_exclude’, function( $is_excluded ) {
$current_user = wp_get_current_user();
$role_to_exclude = ‘name_of_role’;
if ( in_array( $role_to_exclude, (array) $current_user->roles ) ) {
return true;
}
@adrianduffell
adrianduffell / hotfix-cys-wpcom-dynamic-image.php
Last active November 2, 2023 11:58
CYS hotfix for removing wpcom elements from dynamic image
<?php
/*
* Plugin Name: CYS hotfix for removing wpcom elements from dynamic image
* Author: Adrian Duffell
* Description: Hotfix until the following PR is deployed on Woo Express https://github.com/Automattic/wc-calypso-bridge/pull/1344/f
* Version: 1.0.1
*/
add_action( 'wp_head', 'possibly_remove_wpcom_ui_elements' );
@adrianduffell
adrianduffell / hotfix-cys-wpcom-editor.php
Last active October 27, 2023 06:37
Fix CYS conflict with wpcom.editor
<?php
/*
* Plugin Name: CYS hotfix for conflict with wpcom.editor
* Author: Adrian Duffell
* Description: Hotfix until the following PR is deployed on Woo Express https://github.com/Automattic/wc-calypso-bridge/pull/1337
* Version: 1.0.0
*/
add_action( 'admin_print_scripts', function() {
if ( isset( $_GET['path'] ) && str_contains( wp_unslash( $_GET['path'] ), '/customize-store/' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
<?php
/**
* Plugin Name: WooCommerce Calypso Bridge Helper
* Plugin URI: https://woocommerce.com
* Description: Utility to assist testing wc-calypso-bridge locally
* Author: WooCommerce
* Version: 0.1
*/
class Atomic_Plan_Manager {
@adrianduffell
adrianduffell / woocommerce-enable-cot.php
Created August 8, 2022 05:59
WooCommerce Enable COT
<?php
/**
* Plugin Name: WooCommerce Enable COT
* Description: Adds the code to enable Custom Order Tables.
* Version: 0.0.1
*/
function enable_cot(){
$order_controller = wc_get_container()
->get('Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController');