Skip to content

Instantly share code, notes, and snippets.

View lukecav's full-sized avatar
Translucent form radiates

Luke Cavanagh lukecav

Translucent form radiates
View GitHub Profile
@lukecav
lukecav / wc_auto_complete_virtual.php
Created August 4, 2023 13:51 — forked from jessepearson/wc_auto_complete_virtual.php
Auto Complete all WooCommerce virtual orders
<?php // only copy this line if needed
/**
* Auto Complete all WooCommerce virtual orders.
*
* @param int $order_id The order ID to check
* @return void
*/
function custom_woocommerce_auto_complete_virtual_orders( $order_id ) {
@lukecav
lukecav / functions.php
Created November 16, 2022 18:14 — forked from SiR-DanieL/functions.php
functions.php
/**
* Schedule the daily event if necessary.
*/
function schedule_delete_expired_coupons() {
if ( ! wp_next_scheduled( 'delete_expired_coupons' ) ) {
wp_schedule_event( time(), 'daily', 'delete_expired_coupons' );
}
}
add_action( 'init', 'schedule_delete_expired_coupons' );
@lukecav
lukecav / woocommerce-remove-db-update-notice.php
Last active December 24, 2020 18:53 — forked from timmyc/woocommerce-remove-db-update-notice.php
Set WooCommerce database update notice as actioned
<?php
/**
* Plugin Name: Remove WooCommerce DB Notice
* Plugin URI: https://woocommerce.com
* Description: Clears out any pending WooCommerce DB Update notices
* Author: WooCommerce
* Domain Path: /languages
* Version: 0.1
*/
@lukecav
lukecav / custom-woocommerce-status.php
Last active December 15, 2020 17:54 — forked from faiyazalam/custom-woocommerce-status.php
This is a custom plugin for woocommerce. This will add some custom bulk action in order listing.
<?php
/**
* @package Custom_WC_Status
* @version 1.6
*/
/*
Plugin Name: Custom WooCommerce Status
Description: This is a custom plugin for woocommerce. This will add some custom bulk action in order listing.
Author: Luke Cavanagh
Version: 1.0
@lukecav
lukecav / functions.php
Created June 5, 2020 18:19 — forked from ChromeOrange/gist:0853adfb17f8c0e02a58ee8eb0d5fbaf
Add button to clear the WooCommerce logs in System Status Tools
// Uses apply_filters( 'woocommerce_debug_tools', $tools )
add_filter( 'woocommerce_debug_tools', 'woocommerce_debug_tools_remove_logs' );
function woocommerce_debug_tools_remove_logs( $tools ) {
// Disbale Remove Logs button
$disable_remove_logs = apply_filters( 'woocommerce_disable_woocommerce_debug_tools_remove_logs', FALSE );
if( !$disable_remove_logs ) {
$tools['remove_logs'] = array(
@lukecav
lukecav / disable-paypal-for-woocommerce.php
Last active August 27, 2019 00:29 — forked from damiencarbery/disable-cf7.php
Disable PayPal for WooCommerce plugin on all pages other than cart and checkout
<?php
/*
Plugin Name: Disable PayPal for WooCommerce Plugin
Plugin URI: https://github.com/lukecav
Description: Disable PayPal for WooCommerce plugin on all pages other than cart and checkout.
Author: Luke Cavanagh
Version: 1.0.0
*/
@lukecav
lukecav / functions.php
Last active January 18, 2019 17:29 — forked from jessepearson/change_incart_bookings_expiry_minutes.php
Change the amount of minutes for when an In Cart booking expires and gets deleted in WooCommerce Bookings
/**
* Will change the minutes it takes an In Cart booking to expire.
* This example reduces the number from 60 to 5.
*
* @param int $minutes 60 is the default passed
* @return int The amount of minutes you'd like to have In Cart bookings expire on.
*/
function change_incart_bookings_expiry_minutes( $minutes ) {
return 5;
}
@lukecav
lukecav / first_name_last_name_gravity_forms.php
Last active January 10, 2019 17:15 — forked from BronsonQuick/first_name_last_name_gravity_forms.php
Change Gravity Forms name labels from "First" and "Last" to "First Name" and "Last Name"
<?php
function gf_change_first_name( $label, $form_id ){
return "First Name";
}
add_filter( 'gform_name_first', 'gf_change_first_name', 10, 2 );
function gf_change_last_name( $label, $form_id ){
return "Last Name";
}
add_filter( 'gform_name_last', 'gf_change_last_name', 10, 2 );
@lukecav
lukecav / Command
Last active January 22, 2021 13:07 — forked from BronsonQuick/gist:5185918001f4df5c5d15
Delete ActionScheduler comments and scheduled-action post types in WooCommerce using WP-CLI
wp comment list --field=comment_ID --'comment_author'='ActionScheduler' --number=1000 | xargs wp comment delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 | xargs wp post delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=trash | xargs wp post delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=cancel | xargs wp post delete --force
@lukecav
lukecav / functions.php
Created October 29, 2018 14:00 — forked from tareq1988/functions.php
Dokan seller info in popup on the store page
<?php
add_action( 'wp_enqueue_scripts', function() {
if ( ! dokan_is_store_page() ) {
return;
}
wp_enqueue_style('dokan-magnific-popup');
wp_enqueue_script('dokan-popup');
} );