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
add_filter( 'woocommerce_get_catalog_ordering_args','custom_query_sort_args' ); | |
function custom_query_sort_args() { | |
// Sort by and order | |
$current_order = ( isset( $_SESSION['orderby'] ) ) ? $_SESSION['orderby'] : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); | |
switch ( $current_order ) { | |
case 'date' : | |
$orderby = 'date'; | |
$order = 'desc'; |
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
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 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 | |
// Single Product | |
add_filter( 'single_add_to_cart_text', 'custom_single_add_to_cart_text' ); | |
function custom_single_add_to_cart_text() { | |
return 'Add to cart'; // Change this to change the text on the Single Product Add to cart button. | |
} | |
// Variable Product | |
add_filter( 'variable_add_to_cart_text', 'custom_variable_add_to_cart_text' ); |
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
/** | |
* Sort WooCommerce shipping methods by cost, lowest to highest | |
*/ | |
add_filter( 'woocommerce_package_rates' , 'sort_woocommerce_available_shipping_methods', 10, 2 ); | |
function sort_woocommerce_available_shipping_methods( $rates, $package ) { | |
if ( !$rates ) return $rates; | |
$tmp = Array(); | |
foreach( $rates as $ma ) { |
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
/** | |
* Remove postcode requirement if billing or shipping country is Ireland | |
* Add to your theme functions.php file | |
*/ | |
add_action( 'woocommerce_checkout_process', 'custom_country_check' ); | |
function custom_country_check(){ | |
global $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
/** | |
* Modifying Headers | |
* | |
* Add to your theme functions.php | |
*/ | |
add_filter( 'pdf_template_table_headings','custom_pdf_template_table_headings' ); | |
function custom_pdf_template_table_headings( $headers ) { | |
$headers = '<table class="shop_table orderdetails" width="100%">' . | |
'<thead>' . | |
'<tr><th colspan="7" align="left"><h2>' . esc_html__('Order Details', PDFLANGUAGE) . '</h2></th></tr>' . |
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
/** | |
* Add a fixed surcharge to your cart / checkout based on products in cart | |
* Taxes, shipping costs and order subtotal are all included in the surcharge amount | |
* | |
* Change $fixed to set the surcharge to a value to suit | |
* | |
* Change in_array to !in_array to EXCLUDE the $countries array from surcharges | |
* | |
* Uses the WooCommerce fees API | |
* Add to theme functions.php |
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
<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 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 | |
/** | |
* Tab Title filters do not work with WooCommerce 1.6.5.1 or lower | |
* Please download this zip file http://cl.ly/2Y3S3D3M3C23 , extract the 3 files and copy them to : | |
* wp-content/themes/YOUR_THEME/woocommerce/single-product/tabs/ | |
**/ | |
add_filter ( 'woocommerce_product_description_tab_title', 'custom_product_description_tab_title' ) ; | |
function custom_product_description_tab_title() { |
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
/** | |
* Set maximum shipping cost in WooCommerce | |
*/ | |
add_filter( 'woocommerce_package_rates' , 'woocommerce_set_maximum_shipping_cost', 10, 2 ); | |
function woocommerce_set_maximum_shipping_cost( $rates, $package ) { | |
foreach( $rates as $rate ) { | |
// Change 10 to your maximum shipping cost | |
if( $rate->cost > 10 ) { | |
$rate->cost = 10; |
NewerOlder