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 // 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 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 // only copy if needed | |
| /** | |
| * Auto Complete all WooCommerce virtual orders if payment methods match. | |
| * | |
| * @param int $order_id The order ID to check | |
| * @return void | |
| */ | |
| function custom_woocommerce_auto_complete_virtual_orders( $order_id ) { |
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 | |
| /** | |
| * Filter restricted content query args | |
| * | |
| * @since 1.6.3 | |
| * @param array $query_args Args passed to WP_Query | |
| * @param string $query_type Type of request: 'content_restriction', 'product_restriction', 'purchasing_discount' | |
| * @param int $query_paged Pagination request | |
| */ | |
| $query_args = apply_filters( 'wc_memberships_get_restricted_posts_query_args', $query_args, $type, $paged ); |
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 // do not copy this line unless needed | |
| /** | |
| * Remove 'Free!' as the price for grouped products | |
| * | |
| * @param $price string The price | |
| * @param $prod object The product | |
| * @return string The original or modified price. | |
| */ | |
| function remove_free_as_grouped_product_price( $price, $prod ) { |
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 // only copy this line if needed | |
| /** | |
| * This function will set the tax address for WooCommerce AvaTax when local_pickup is chosen | |
| * | |
| * @param $address array The orignal address | |
| * @return array The original or modified address. | |
| */ | |
| function adjust_local_pickup_tax_address_for_avatax( $address ) { | |
| // get the chosen shipping method |
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 // 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 ) { |
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 // 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 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 //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 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 // copy this line only if needed, usually it's not needed | |
| /** | |
| * Function filters the price of products looking for "Free!" and replaces it with "$0.00" | |
| * | |
| * @param string $price The price being passed | |
| * @param object $product The product we're looking at | |
| * @return string The filtered price | |
| */ | |
| function lets_replace_free_with_zeros( $price, $product ) { |
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 // Do not copy this line unless needed | |
| /** | |
| * As of Bookings 1.9.13 the current date will be shown in the calendar for performance reasons. | |
| * To return to the previous functionality, a filter was put in place. The below function uses this | |
| * filter to tell Bookings to show the calendar month when the first block is available. | |
| * @param bool $move - This is here just to prevent errors | |
| * @return bool false for first block's month, true for current month | |
| */ | |
| function move_bookings_calendar_to_first_available_block( $move ) { |