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
<?php | |
add_shortcode('soldoutproducts', 'custom_woocommerce_soldout_products'); | |
/** | |
* Recent Products shortcode with custom styles | |
**/ | |
function custom_woocommerce_soldout_products( $atts ) { | |
global $woocommerce_loop; |
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
<?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 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
function jeherve_delete_jetpack_menu() { | |
if ( ! current_user_can( 'manage_options' ) ) { | |
remove_menu_page( 'jetpack' ); | |
} | |
} | |
add_action ( 'admin_menu', 'jeherve_delete_jetpack_menu', 999 ); |
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 field to order emails | |
**/ | |
add_filter('woocommerce_email_order_meta_keys', 'my_custom_checkout_field_order_meta_keys'); | |
function my_custom_checkout_field_order_meta_keys( $keys ) { | |
$keys[‘My Field 1′] = ‘_my_field_1; | |
$keys[‘My Field 2′] = ‘_my_field_2′; | |
return $keys; | |
} |
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
<?php | |
// add custom field to invoice email | |
add_action( 'woocommerce_email_after_order_table', 'woocommerce_custom_invoice_fields' ); | |
function woocommerce_custom_invoice_fields( $order ) { | |
?> | |
<p><strong><?php _e('Free Book:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Free Book', true ); ?></p> | |
<p><strong><?php _e('Free DVD:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Free DVD', true ); ?></p> | |
<p><strong><?php _e('Gift:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Gift Order', true ); ?></p> | |
<p><strong><?php _e('Gift Message:', 'woocommerce'); ?></strong> <?php echo get_post_meta( $order->id, 'Special Gift Message', true ); ?></p> | |
<?php |
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
<?php | |
add_filter( 'woocommerce_checkout_fields' , 'woo_remove_billing_checkout_fields' ); | |
/** | |
* Remove unwanted checkout fields | |
* | |
* @return $fields array | |
*/ | |
function woo_remove_billing_checkout_fields( $fields ) { |
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
/** | |
* WooCommerce Extra Feature | |
* -------------------------- | |
* Add another email recipient when an order is completed | |
*/ | |
function woo_extra_email_recipient($recipient, $object) { | |
$recipient = $recipient . ', [email protected]'; | |
return $recipient; | |
} | |
add_filter( 'woocommerce_email_recipient_customer_completed_order', 'woo_extra_email_recipient', 10, 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
<?php | |
// Add WooCommerce customer username to edit/view order admin page | |
add_action( 'woocommerce_admin_order_data_after_billing_address', 'woo_display_order_username', 10, 1 ); | |
function woo_display_order_username( $order ){ | |
global $post; | |
$customer_user = get_post_meta( $post->ID, '_customer_user', true ); | |
echo '<p><strong style="display: block;">'.__('Customer Username').':</strong> <a href="user-edit.php?user_id=' . $customer_user . '">' . get_user_meta( $customer_user, 'nickname', true ) . '</a></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
<?php | |
// Remove items from the admin bar to not administrators | |
add_action( 'wp_before_admin_bar_render', 'hide_before_admin_bar_render' ); | |
function hide_before_admin_bar_render() { | |
if (!current_user_can('administrator')) { | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu('wp-logo'); //WordPress Logo | |
$wp_admin_bar->remove_menu('site-name'); //Site Name | |
$wp_admin_bar->remove_menu('view-site'); //View Site | |
$wp_admin_bar->remove_menu('comments'); //Comments |