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
/** | |
* I have a WooCommerce Subscription product set up to bill every 2nd month | |
* The product is also set up to synchronize payments to the 25th of each month | |
* and the products are shipped on the 1st of every 2nd month - the shipping | |
* schedule is fixed, i.e. shipments only go out on even numbered months | |
* | |
* How can I prevent my customers from being billed 5 weeks before their first box | |
* actually goes out? | |
*/ | |
add_filter( 'woocommerce_subscriptions_synced_first_payment_date', 'wooninja_filter_first_payment_date', 10, 2 ); |
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_free_price_html', 'wooninja_modify_free_price' ); | |
function wooninja_modify_free_price( $price ) { | |
//modify MY FREE PRICE to fit your needs :) | |
return 'MY FREE PRICE'; | |
} |
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_get_price_html', 'wooninja_free_price_replace', 99, 2 ); | |
function wooninja_free_price_replace( $price_html, $product ) { | |
if ( 'booking' == $product->product_type ) { | |
$price_html = str_replace( 'Free', 'MY REPLACEMENT', $price_html ); | |
} | |
return $price_html; | |
} |
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
/** | |
* By default, WooCommerce will capitalize order item meta labels | |
* in some cases this may be undesirable, use this snippet to | |
* un-do the capitalization | |
* @see wc function wc_attribute_label in includes/wc-attribute-functions.php | |
*/ | |
add_filter( 'woocommerce_attribute_label', 'wooninja_attribute_label', 10, 2 ); | |
function wooninja_attribute_label( $formatted_label, $original_label ) { | |
return $original_label; |
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; | |
} |
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( '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
#!/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_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
<?php | |
class My_Custom_My_Account_Endpoint { | |
/** | |
* Custom endpoint name. | |
* | |
* @var string | |
*/ | |
public static $endpoint = 'my-custom-endpoint'; |