This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Not sure what to do with these code snippets? See: https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/ */ | |
add_filter( 'wc_stripe_require_3ds', 'handsome_beardedguy_maybe_force_3ds', 10, 2 ); | |
function handsome_beardedguy_maybe_force_3ds( $required, $source_object ) { | |
return ( is_object( $source_object ) && property_exists( $source_object, 'card' ) && 'optional' === $source_object->card->three_d_secure ) ? true : $required; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Don't know what to do with this? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/ | |
add_filter( 'wc_bookings_product_get_available_blocks', 'beardedguy_maybe_remove_availability', 10, 5 ); | |
function beardedguy_maybe_remove_availability( $available_blocks, $booking_object, $blocks, $intervals, $resource_id ) { | |
return ( sizeof( $available_blocks ) < sizeof( $blocks ) ) ? array() : $available_blocks; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'pre_get_posts', 'handsome_bearded_guy_show_photograhpy_products', 99 ); | |
function handsome_bearded_guy_show_photograhpy_products( $query ) { | |
if ( ! $query->is_main_query() || is_admin() ) { | |
return; | |
} | |
if ( isset( $query->query_vars['tax_query'] ) && is_post_type_archive( 'product' ) || ( is_page() && isset( $query->query_vars['page_id'] ) && wc_get_page_id( 'shop' ) == $query->query_vars['page_id'] ) && ! is_search() ) { | |
foreach ( $query->query_vars['tax_query'] as $key => $arr ) { | |
if ( in_array( 'photography', $arr['terms'] ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'booking_form_fields', 'handsomebeardedguy_booking_form_fields' ); | |
function handsomebeardedguy_booking_form_fields( $fields ) { | |
if ( isset( $fields['wc_bookings_field_resource'] ) ) { | |
$pattern = '#\(\+*.*\)#'; | |
$replacement = ''; | |
foreach ( $fields['wc_bookings_field_resource']['options'] as $key => $value ) { | |
$fields['wc_bookings_field_resource']['options'][ $key ] = preg_replace( $pattern, $replacement, $value ); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Custom_My_Account_Endpoint { | |
/** | |
* Custom endpoint name. | |
* | |
* @var string | |
*/ | |
public static $endpoint = 'my-custom-endpoint'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_loaded', 'handsome_bearded_guy_wc_loaded' ); | |
function handsome_bearded_guy_wc_loaded() { | |
$old_statuses = array( | |
'failed', | |
//uncomment any of the below statuses to include those statuses | |
//'pending', | |
//'processing', | |
//'on-hold', | |
//'cancelled', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# script to check for complete torrents in transmission folder, then stop and move them | |
# either hard-code the MOVEDIR variable here… | |
MOVEDIR=/home/mjdescy/media # the folder to move completed downloads to | |
# …or set MOVEDIR using the first command-line argument | |
# MOVEDIR=%1 | |
# use transmission-remote to get torrent list from transmission-remote list | |
# use sed to delete first / last line of output, and remove leading spaces | |
# use cut to get first field from each line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_subscriptions_product_sign_up_fee', 'handsome_bearded_guy_filter_sign_up_fee', 10, 2 ); | |
function handsome_bearded_guy_filter_sign_up_fee( $subscription_sign_up_fee, $product ) { | |
//this will only work if the necessary object and method are present | |
if ( class_exists( 'WC_Memberships_Member_Discounts' ) && method_exists( 'WC_Memberships_Member_Discounts', 'get_discounted_price' ) ) { | |
$discounter = new WC_Memberships_Member_Discounts; | |
//taken from WooCommerce Memberships | |
/** | |
* Get product discounted price for member | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/ | |
add_filter( 'woocommerce_booking_single_check_availability_text', 'wooninja_booking_check_availability_text' ); | |
function wooninja_booking_check_availability_text() { | |
return "MY CUSTOM TEXT"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'booking_form_fields', 'wooninja_booking_form_fields' ); | |
function wooninja_booking_form_fields( $fields ) { | |
//Changes the text 'Day(s)' to 'Night(s)' | |
$fields['wc_bookings_field_duration']['after'] = str_replace( 'Day(s)', 'Night(s)', $fields['wc_bookings_field_duration']['after'] ); | |
return $fields; | |
} |