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 | |
add_action( 'woocommerce_before_my_account', 'woocommerce_customer_licenses_my_account' ); | |
function woocommerce_customer_licenses_my_account() { | |
global $wpdb; | |
$current_user = wp_get_current_user(); | |
$licence_keys = $wpdb->get_results( | |
$wpdb->prepare( | |
" | |
SELECT * FROM {$wpdb->prefix}woocommerce_software_licences | |
WHERE activation_email = %s |
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 | |
// Page Title, displayed as the title of the browser | |
add_filter( 'eway_shared_page_tite', 'woocommerce_eway_page_title' ); | |
function woocommerce_eway_page_title() { | |
return __( 'My New Page Title', 'woocommerce' ); | |
} | |
// Company Name, the name of the company the customer is buying from | |
add_filter( 'eway_shared_company_name', 'woocommerce_eway_company_name' ); |
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 | |
function get_user_role() { | |
global $current_user; | |
$user_roles = $current_user->roles; | |
$user_role = array_shift($user_roles); | |
return $user_role; | |
} |
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 | |
// Place the following code in your theme's functions.php file and replace tax_exempt_role with the name of the role to apply to | |
add_action( 'init', 'woocommerce_customer_tax_exempt' ); | |
function woocommerce_customer_tax_exempt() { | |
global $woocommerce; | |
if ( is_user_logged_in() ) { | |
$tax_exempt = current_user_can( 'tax_exempt_role'); | |
$woocommerce->customer->set_is_vat_exempt( $tax_exempt ); | |
} | |
} |
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 | |
add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 ); | |
function hide_standard_shipping_when_free_is_available( $available_methods ) { | |
if( isset( $available_methods['free_shipping'] ) ) { | |
$methods = $available_methods; | |
foreach( $methods as $key => $method ) { | |
if ( $key <> 'free_shipping' ) | |
unset( $available_methods[$key] ); | |
} | |
} |
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 to functions.php | |
/*=================================================== | |
Created by sk from Renegade Empire with help | |
from these sources: | |
http://docs.woothemes.com/document/editing-product-data-tabs/ | |
http://www.sean-barton.co.uk/2013/03/remove-woocommerce-20-reviews-tab/#.UYnWe7XfB6N | |
http://www.sean-barton.co.uk/2013/03/sb-add-woocommerce-tabs-wordpress-plugin/#.UYrYL7XfB6M |
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 | |
add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 ); | |
function wc_product_sold_count() { | |
global $product; | |
$units_sold = get_post_meta( $product->id, 'total_sales', true ); | |
echo '<p>' . sprintf( __( 'Units Sold: %s', 'woocommerce' ), $units_sold ) . '</p>'; | |
} | |
?> |
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 | |
add_filter( 'product_enquiry_send_to', 'wc_product_enquiry_to_vendor', 10, 2 ); | |
function wc_product_enquiry_to_vendor( $email, $product_id ) { | |
$vendors = get_product_vendors( $product_id ); | |
if ( ! empty( $vendors ) ) { | |
$emails = array(); | |
foreach( $vendors as $vendor ) { | |
foreach( $vendor->admins as $admin ) { | |
$emails[] = $admin->data->user_email; | |
} |
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 | |
add_filter( 'init', 'wc_tax_exempt_user_roles' ); | |
function wc_tax_exempt_user_roles() { | |
if ( ! is_admin() ) { | |
global $woocommerce; | |
if ( current_user_can('wholesaler') || current_user_can('distributor') ) { | |
$woocommerce->customer->set_is_vat_exempt(true); | |
} else { | |
$woocommerce->customer->set_is_vat_exempt(false); | |
} |
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 | |
add_filter( 'woocommerce_single_product_image_html', 'wc_product_image_slider' ); | |
function wc_product_image_slider() { | |
return do_shortcode( '[wooslider slider_type="attachments"]' ); | |
} | |
?> |