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 | |
/** | |
* Plugin Name: Multiple Roles per User | |
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful. | |
* Version: 1 | |
* Author: nikolov.tmw | |
* Author URI: http://paiyakdev.com/ | |
* License: GPL2 | |
*/ | |
/* |
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 | |
/* | |
* goes in theme functions.php or a custom plugin. Replace the image filename/path with your own :) | |
* | |
**/ | |
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src'); | |
function custom_woocommerce_placeholder_img_src( $src ) { | |
$upload_dir = wp_upload_dir(); |
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 global $woocommerce; ?> | |
<a class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> - <?php echo $woocommerce->cart->get_cart_total(); ?></a> |
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 | |
/** | |
* Manipulate default state and countries | |
* | |
* As always, code goes in your theme functions.php file | |
*/ | |
add_filter( 'default_checkout_country', 'change_default_checkout_country' ); | |
add_filter( 'default_checkout_state', 'change_default_checkout_state' ); | |
function change_default_checkout_country() { |
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 | |
/** | |
* Code goes in functions.php or a custom plugin. | |
*/ | |
add_filter( 'woocommerce_states', 'malaysia_woocommerce_states' ); | |
function malaysia_woocommerce_states( $states ) { | |
$states['MY'] = array( | |
'JHR' => __('Johor', '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
<?php | |
/** | |
* Code goes in functions.php or a custom plugin. | |
*/ | |
add_filter( 'woocommerce_states', 'indian_woocommerce_states' ); | |
function indian_woocommerce_states( $states ) { | |
$states['IN'] = array( | |
'AP' => __('Andra Pradesh', '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
<?php | |
add_action( 'pre_get_posts', 'mj_change_per_page' ); | |
function mj_change_per_page() { | |
if ( is_product_category( 'games' ) ) { | |
add_filter('loop_shop_per_page', create_function('$cols', 'return 1;') ); | |
} else { | |
add_filter('loop_shop_per_page', create_function('$cols', 'return 8;') ); | |
} |
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( 'wp' , 'wc_order_tabs' ); | |
function wc_order_tabs() { | |
// Remove tabs | |
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 ); | |
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 ); | |
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 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 | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display'); | |
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_upsells', 20); | |
if (!function_exists('woocommerce_output_upsells')) { | |
function woocommerce_output_upsells() { | |
woocommerce_upsell_display(3,3); // Display 3 products in rows of 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 | |
add_action( 'woocommerce_order_status_completed', 'custom_send_email_from_customer' ); | |
function custom_send_email_from_customer( $order_id ) { | |
$order = new WC_Order( $order_id ); | |
$headers = 'From: ' . $order->billing_first_name . ' ' . $order->billing_last_name . ' <' . $order->billing_email . '>' . "\r\n"; | |
wp_mail( 'someone@somesite.com', 'Subject', 'Message', $headers ); | |
} | |
?> |
NewerOlder