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_sagepay_direct_data', 'telephone_order_payment', 10, 2 ); | |
function telephone_order_payment( $data, $order ) { | |
$order_id = $order->get_id(); | |
$type = get_post_meta( $order_id, '_created_via', TRUE); | |
if ( $type !== 'checkout' ) { | |
$data['AccountType'] = 'M'; | |
} |
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( 'pdf_invoice_payment_method_title', 'custom_pdf_invoice_payment_method_title', 10, 2 ); | |
function custom_pdf_invoice_payment_method_title( $payment_method_title, $order_id ) { | |
$transaction_id = get_post_meta( $order_id, '_transaction_id', TRUE ); | |
if( isset( $transaction_id ) && $transaction_id != '' ) { | |
$payment_method_title .= "<br />(" . $transaction_id . ")"; | |
} | |
return $payment_method_title; |
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 to your custom functions | |
// Uses apply_filters( 'woocommerce_debug_tools', $tools ) | |
add_filter( 'woocommerce_debug_tools', 'woocommerce_debug_tools_remove_logs' ); | |
function woocommerce_debug_tools_remove_logs( $tools ) { | |
// Disbale Remove Logs button | |
$disable_remove_logs = apply_filters( 'woocommerce_disable_woocommerce_debug_tools_remove_logs', FALSE ); | |
if( !$disable_remove_logs ) { |
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
<html> | |
<head> | |
<meta http-equiv='Refresh' content='2; Url="<WPDISPLAY ITEM=MC_callback>&MC_order=<WPDISPLAY ITEM=MC_order>&transId=<WPDISPLAY ITEM=transId>&transStatus=<WPDISPLAY ITEM=transStatus>&transTime=<WPDISPLAY ITEM=transTime>&authAmount=<WPDISPLAY ITEM=authAmount>&authCurrency=<WPDISPLAY ITEM=authCurrency>&rawAuthMessage=<WPDISPLAY ITEM=rawAuthMessage>&rawAuthCode=<WPDISPLAY ITEM=rawAuthCode>&callbackPW=<WPDISPLAY ITEM=callbackPW>&cardType=<WPDISPLAY ITEM=cardType>&countryMatch=<WPDISPLAY ITEM=countryMatch>&AVS=<WPDISPLAY ITEM=AVS>&MC_transactionNumber=<WPDISPLAY ITEM=MC_transactionNumber>&futurePayId=<WPDISPLAY ITEM=futurePayId>&futurePayStatusChange<WPDISPLAY ITEM=futurePayStatusChange>"'> | |
<title>Payment Successful</title> | |
</head> | |
<h1>Payment Successful</h1> | |
<a href="<WPDISPLAY ITEM=MC_callback>&MC_order=<WPDISPLAY ITEM=MC_order>&transId=<WPDISPLAY ITEM=transId>&transStatus=<WPDISPLAY ITEM=transStatus>&transTime=<WPDISPLAY ITEM=transTime>&authAmount=<WPDISPLAY ITEM=authAmount>&authCurrency=<WPDISP |
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( 'pdf_invoice_item_name', 'add_product_description_pdf_invoice_item_name', 10, 4 ); | |
function add_product_description_pdf_invoice_item_name( $item_name, $item, $product, $order ) { | |
// Use $product->get_id() if you want to get the post id for the product. | |
$item_name .= '<p>' . $product->get_description() . '</p>'; | |
return $item_name; | |
} |
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
'attributes' => array( | |
array( | |
'name' => 'Brand', | |
'slug' => 'pa_brand', | |
'options' => array( | |
'Kravet Basics' | |
), | |
'visible' => true | |
) | |
) |
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', 'custom_woocommerce_email_order_meta', 10,3 ); | |
function custom_woocommerce_email_order_meta ( $order, $sent_to_admin, $plain_text ) { | |
wp_mail( 'YOUR_EMAIL_ADDRESS', 'woocommerce_email_order_meta ' . time(), '<pre>' . print_r( $order, TRUE ) . '</pre>' ); | |
} |
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_paypal_args', 'fix_paypal_rounding_errors', 10, 2 ); | |
function fix_paypal_rounding_errors ( $paypal_args = NULL, $order = NULL ) { | |
if( $paypal_args ) { | |
foreach( $paypal_args as $key => $value ) { | |
if( substr( $key, 0, 7 ) == 'amount_' || substr( $key, 0 , 9 ) == 'shipping_' ) { | |
$paypal_args[$key] = number_format( round($value,2), 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
if ( $this->debug ) { | |
echo "REQUEST:\n" .'<pre>' . htmlentities( str_replace( "><", ">\r\n<", $client->__getLastRequest()) ). '</pre>' . "\n"; | |
echo "RESPONSE:\n" .'<pre>' . htmlentities( str_replace( "><", ">\r\n<", $client->__getLastResponse()) ). '</pre>' . "\n"; | |
} |
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_check_cart_items', 'wc_minimum_order_amount' ); | |
function wc_minimum_order_amount() { | |
// Set this variable to specify a minimum order value | |
$minimum = 50; | |
if ( WC()->cart->total < $minimum ) { | |
WC()->add_error( sprintf( 'You must have an order with a minimum of %s to place your order, your current order total is %s.' , | |
woocommerce_price( $minimum ), |
NewerOlder