Skip to content

Instantly share code, notes, and snippets.

View sisaacrussell's full-sized avatar

Isaac Russell sisaacrussell

View GitHub Profile
<?php
/**
* Autocomplete orders with virtual products (WC 2.2+)
*
* @see https://metorik.com/blog/autocomplete-all-the-orders-in-woocommerce
*/
function bryce_autocomplete_virtual_orders( $order_status, $order_id ) {
$order = wc_get_order( $order_id );
@sisaacrussell
sisaacrussell / functions.php
Created June 14, 2019 17:10 — forked from WebEndevSnippets/functions.php
Gravity Forms: Auto login to site after GF User Registration Form Submittal
add_action( 'gform_user_registered','we_autologin_gfregistration', 10, 4 );
/**
* Auto login to site after GF User Registration Form Submittal
*
*/
function we_autologin_gfregistration( $user_id, $config, $entry, $password ) {
wp_set_auth_cookie( $user_id, false, '' );
}
@sisaacrussell
sisaacrussell / sample functions with changed text.php
Created August 23, 2019 18:29 — forked from theeventscalendar/sample functions with changed text.php
This is an example of a functions.php file with custom text added.
<?php
/*
* EXAMPLE OF CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR
* See the codex to learn more about WP text domains:
* http://codex.wordpress.org/Translating_WordPress#Localization_Technology
* Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
*/
function tribe_custom_theme_text ( $translation, $text, $domain ) {
@sisaacrussell
sisaacrussell / change-wording-with-context.php
Created August 23, 2019 18:30 — forked from andrasguseo/change-wording-with-context.php
Change the wording of any bit of text or string, which has a context
<?php
function tribe_custom_theme_text_with_context ( $translation, $text, $context, $domain ) {
// Put your custom text here in a key => value pair
// Example: 'Text you want to change' => 'This is what it will be changed to'
// The text you want to change is the key, and it is case-sensitive
// The text you want to change it to is the value
// You can freely add or remove key => values, but make sure to separate them with a comma
// This example changes the label "Venue" to "Location", and "Related Events" to "Similar Events"
@sisaacrussell
sisaacrussell / tickets-plus-disable-tax.php
Last active September 19, 2019 18:53 — forked from jesseeproductions/tickets-plus-disable-tax.php
Event Tickets Plus - Disable Taxes for Ticket Products
<?php
/**
* Event Tickets Plus - Disable Taxes for Ticket Products
*/
function tribe_disable_taxes_ticket_product( $post_id, $ticket ) {
update_post_meta( $ticket->ID, '_tax_status', 'none' );
update_post_meta( $ticket->ID, '_tax_class', 'zero-rate' );
}
add_action( 'event_tickets_after_save_ticket', 'tribe_disable_taxes_ticket_product', 10, 2 );
@sisaacrussell
sisaacrussell / increase-variation-threshold.php
Created March 29, 2022 17:46 — forked from jessepearson/increase-variation-threshold.php
Increase the number of variations loaded in the WooCommerce front end for dynamic filtering of available variations in the drop down lists.
<?php //only copy this line if needed
/**
* Function filters the threshold for the amount of variables to load in the front end.
*
* @see https://woocommerce.wordpress.com/2015/07/13/improving-the-variations-interface-in-2-4/
*
* @return int 100 The new threshold.
*/
add_filter( 'woocommerce_ajax_variation_threshold', function() { return 100; } );