Skip to content

Instantly share code, notes, and snippets.

@justinshreve
justinshreve / enable-new-wc-onboarding.php
Created December 17, 2019 12:20
enable-new-wc-onboarding.php
<?php
/*
Plugin Name: Enable WooCommerce Onboarding Split Test
Description: Puts the site into the test group for WooCommerce Onboarding split testing.
Version: 1.0.0
Author: Automattic
License: GPL2
*/
function woocommerce_admin_set_test_group() {
return 'b';
@justinshreve
justinshreve / send-auto-update-debug-email.php
Created July 19, 2017 15:37
Sends debug emails for WP auto updates
<?php
/**
* Plugin Name: Send Automatic Update Debug Emails
* Description: Sends automatic Update Debug Emails
* Version: 0.1
*/
add_filter( 'automatic_updates_send_debug_email', '__return_true' );
@justinshreve
justinshreve / auto-update.php
Created June 28, 2017 18:50
Force auto update
<?php
// Force an auto update
require( dirname(__FILE__) . '/wp-load.php' );
delete_option( 'auto_updater.lock' );
wp_maybe_auto_update();
<?php
/**
* Legacy Customers API Tests
* @package WooCommerce\Tests\API
*/
class WC_Tests_API_Legacy_Customers extends WC_API_Unit_Test_Case {
/** @var WC_API_Customers instance */
protected $endpoint;
@justinshreve
justinshreve / wc-refund-item-info.php
Last active February 21, 2017 18:56
WooCommerce: Get item info from refunds
<?php
// Get items from all refunds
$refunds = array();
$refund_items = get_posts( array(
'post_type' => 'shop_order_refund',
'posts_per_page' => -1,
'post_status' => 'any',
'fields' => 'ids'
) );
@justinshreve
justinshreve / woocommerce-cancel-unpaid-bookings.php
Created November 2, 2015 16:04
Allows WooCommerce booking orders to be canceled by the cancel unpaid orders cron job.
<?php
/*
* Plugin Name: Cancel Unpaid Bookings
* Author: WooThemes
* Description: Allows booking orders to be canceled by the cancel unpaid orders cron job.
*/
// woocommerce-cancel-unpaid-bookings.php
function woocommerce_cancel_unpaid_booking_orders_from_admin( $return, $order ) {