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. | |
// This is a filter to disable Multi-Currency in WooCommerce Payments. | |
add_filter( | |
'pre_option__wcpay_feature_customer_multi_currency', | |
function ( $pre_option, $option, $default ) { | |
return '0'; | |
}, | |
10, | |
3 |
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 | |
add_filter( | |
'wcpay_multi_currency_available_currencies', | |
function ( $currencies ) { | |
$currencies[] = 'BTC'; | |
sort( $currencies ); | |
return array_unique( $currencies ); | |
} | |
); |
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. | |
/** | |
* Will clear out all the specified completed scheduled actions, 5000 at a time. | |
*/ | |
function clear_woocommerce_scheduled_actions_20200609() { | |
global $wpdb; | |
$limit = 5000; | |
$actions_table = $wpdb->prefix . 'actionscheduler_actions'; |
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 to change up the name of the Distance Rate label for WooCommerce Distance Rate Shipping. | |
*/ | |
add_filter( 'woocommerce_shipping_method_add_rate_args', 'jp_woocommerce_shipping_method_add_rate_args_2021_01_11', 50, 2 ); | |
function jp_woocommerce_shipping_method_add_rate_args_2021_01_11( $args, $package ) { | |
// Check to see if it's a distance rate method. | |
if ( false !== strpos( $args['id'], 'distance_rate' ) ) { |
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 | |
add_action( 'woocommerce_checkout_update_order_review', 'set_vat_exempt_for_customer_20201104', 10 ); | |
function set_vat_exempt_for_customer_20201104( $post_data ) { | |
if ( isset( $_POST['country'] ) | |
&& isset( $_POST['state'] ) | |
&& 'ES' === $_POST['country'] | |
&& 'TF' === $_POST['state'] ) { |
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 | |
/** | |
* 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 // do not copy this line | |
/** | |
* Note: This has not been tested on a live site and is to be used at your own risk. | |
* | |
* This will dequeue the JavaScript files from WooCommerce Square on all pages except the checkout page. | |
*/ | |
add_action( 'wp_enqueue_scripts', 'dequeue_wc_square_js_scripts_20200713', 999 ); | |
function dequeue_wc_square_js_scripts_20200713() { | |
// Not needed in admin, and we want to keep in checkout |
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 | |
/** | |
* Adds hook to the AutomateWoo order paid action to add a filter. | |
*/ | |
add_action( 'automatewoo/order/paid_async', 'add_automatewoo_note_filter_20200702' ); | |
function add_automatewoo_note_filter_20200702() { | |
add_filter( 'woocommerce_new_order_note_data', 'add_author_to_automatewoo_note_20200702' ); | |
} |
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 | |
/** | |
* Attempts to remove all shutdown actions if file is being downloaded via WC. | |
*/ | |
function remove_all_shutdown_actions_20200618() { | |
remove_all_actions( 'shutdown' ); | |
} | |
add_action( 'woocommerce_download_file_redirect', 'remove_all_shutdown_actions_20200618', 1 ); | |
add_action( 'woocommerce_download_file_xsendfile', 'remove_all_shutdown_actions_20200618', 1 ); |
NewerOlder