This file contains 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 // only copy this line if needed | |
// related blog post: https://jessepearson.net/2016/11/woocommerce-bookings-cod-payments/ | |
/** | |
* Function that will put bookings into a Confirmed status if they were paid for via COD | |
* | |
* @param int/string $order_id The order id | |
* @return null | |
*/ | |
function lets_confirm_some_cod_bookings( $order_id ) { | |
global $wpdb; |
This file contains 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 // 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 ) { |
This file contains 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 // do not copy this line | |
/** | |
* WordPress will automatically create a Mine view for post types that have multiple authors. | |
* With a recent change to WooCommerce core, the customers are now the author of the orders, so Mine is | |
* showing and causing confusion. This filter will remove Mine from orders. | |
* | |
* @param arr $views The current views being used for orders. | |
* @return arr The edited views array. | |
*/ |
This file contains 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 // do not copy this line | |
/** | |
* Disables opening the Terms and Conditions page in an inline form on the Checkout page. | |
* The Terms and Conditions link will then open in a new tab/window. | |
*/ | |
add_action( 'wp', function() { | |
remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_checkout_privacy_policy_text', 20 ); | |
remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 ); | |
} ); |
This file contains 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 // do not copy this line | |
function jp_change_brand_thumbnail_size( $size ) { | |
// You would need to create a new size, or use an existing size. | |
// The plugin https://wordpress.org/plugins/simple-image-sizes/ is perfect for this. | |
return 'new_brand_thumbnail_size'; | |
} | |
add_filter( 'woocommerce_brand_thumbnail_size', 'jp_change_brand_thumbnail_size' ); |
This file contains 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 // do not copy this line | |
/** | |
* Allows for modifying the coupon that is created when AutomateWoo Refer A Friend is used. | |
* | |
* It works by modifying the coupon data that is used when creating the new coupon in the cart. The data that is | |
* able to be applied can be found here: https://github.com/woocommerce/woocommerce/blob/4.3.0/includes/class-wc-coupon.php#L26-L50 | |
* Any edits will make the automatically generated coupon behave like a coupon created under WooCommerce > Coupons. | |
* | |
* This example make it so that if either categories 24 or 25 are in the cart, the referral is then applied. |
This file contains 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 //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; } ); |
This file contains 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 // do not copy this line | |
if( ! function_exists( 'mc_child_custom_woocommerce_states' ) ) { | |
function mc_child_custom_woocommerce_states( $states ) { | |
$states['LK'] = array( | |
'LK1001' => __( 'Colombo 1', 'woocommerce' ), | |
'LK1002' => __( 'Colombo 2', 'woocommerce' ), | |
'LK1003' => __( 'Colombo 3', 'woocommerce' ), | |
'LK1004' => __( 'Colombo 4', 'woocommerce' ), |
This file contains 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 // only copy this line if needed | |
/** | |
* Function adds a BCC header to emails that match our array | |
* | |
* @param string $headers The default headers being used | |
* @param string $object The email type/object that is being processed | |
*/ | |
function add_bcc_to_certain_emails( $headers, $object ) { |