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_wirecard_icon', 'wirecard_filter_gateway_icon' ); | |
function wirecard_filter_gateway_icon( $icon ) { | |
$icon = 'path/to/your/gateway/icon.png'; | |
return $icon; | |
} |
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_email_after_order_table', 'add_link_back_to_order', 10, 2 ); | |
function add_link_back_to_order( $order, $is_admin ) { | |
// Only for admin emails | |
if ( ! $is_admin ) { | |
return; | |
} | |
// Open the section with a paragraph so it is separated from the other content | |
$link = '<p>'; |
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( 'activate_header', 'check_activation_key_redirect_to_page' ); | |
/** | |
* Check the wp-activate key and redirect the user to home page. | |
*/ | |
function check_activation_key_redirect_to_page() { | |
// We check if the key is not empty | |
if ( ! empty($_GET['key']) && ! empty($_POST['key']) ) { | |
$key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key']; | |
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('my_do_active_user_message_hook', 'check_header_for_active_user'); | |
/** | |
* Check for the set activated user and echo a message on the home page | |
*/ | |
function check_header_for_active_user() { | |
if ( ! session_id() ) { | |
session_start(); | |
} | |
if ( isset($_SESSION['my_active_user_variable']) && ! empty( $_SESSION['my_active_user_variable'] ) ) { | |
$user = $_SESSION['my_active_user_variable']; |
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
// Use the filter to any status to the Order sync watch list. | |
add_filter( 'wc_tradegecko_query_orders_status', 'wc_tg_add_orders_sync_statuses' ); | |
function wc_tg_add_orders_sync_statuses( $statuses ) { | |
// Here you add all statuses that you want to support. | |
// They should be in array format and the value should be the status slug | |
// For WC 2.2+ statuses are added with "wc-" prefix, like this | |
$statuses[] = 'wc-pending'; // for Pending Payment status | |
$statuses[] = 'wc-on-hold'; // for On Hold status | |
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_email_order_meta', 'woo_add_order_notes_to_email', 10, 3 ); | |
function woo_add_order_notes_to_email( $order, $sent_to_admin = true, $plain_text = false ) { | |
// You want to send those only to the Admin | |
if ( ! $sent_to_admin ) { | |
return; | |
} | |
// You can also check which email you are sending, by checking the order status | |
// Optional, comment it out, if not needed |
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 the code to your theme functions.php file | |
*/ | |
// Remove the order meta function from the email | |
remove_action( 'woocommerce_email_order_meta', array( WC()->mailer(), 'order_meta' ), 10, 3 ); | |
// Add your own order meta function | |
add_action( 'woocommerce_email_order_meta', 'woo_add_order_notes_to_email', 10, 3 ); | |
function woo_add_order_notes_to_email( $order, $sent_to_admin = true, $plain_text = false ) { |
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
/** | |
* You need the order object here. | |
* So we'll assume you already have it. | |
* | |
* To get the order you can call | |
* $order = wc_get_order( $order_id ); | |
*/ | |
// Get Order items | |
$items = $order->get_items(); |
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 your own action for the bank instructions | |
add_action( 'woocommerce_email_before_order_table', 'prefix_email_instructions', 9, 3 ); | |
function prefix_email_instructions( $order, $sent_to_admin, $plain_text = false ) { | |
// Get the gateway object | |
$gateways = WC_Payment_Gateways::instance(); | |
$available_gateways = $gateways->get_available_payment_gateways(); | |
$gateway = isset( $available_gateways['bacs'] ) ? $available_gateways['bacs'] : false; | |
// We won't do anything if the gateway is not available | |
if ( false == $gateway ) { |
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
// Normal order | |
add_filter( 'wc_paysafe_request_params', 'prefix_remove_ip_address', 10, 2 ); | |
// Subscriptions/Pre-Orders order | |
add_filter( 'wc_paysafe_addons_request_params', 'prefix_remove_ip_address', 10, 2 ); | |
function prefix_remove_ip_address( $params, $order ) { | |
if ( isset( $params['customerIp'] ) ) { | |
unset( $params['customerIp'] ); | |
} | |
return $params; |
OlderNewer