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_action( 'wp', 'remove_product_content' ); | |
function remove_product_content() { | |
// If a product in the 'Cookware' category is being viewed... | |
if ( is_product() && has_term( 'Cookware', 'product_cat' ) ) { | |
//... Remove the images | |
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); | |
// For a full list of what can be removed please see woocommerce-hooks.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
add_action( 'pre_get_posts', 'custom_pre_get_posts_query' ); | |
function custom_pre_get_posts_query( $q ) { | |
if ( ! $q->is_main_query() ) return; | |
if ( ! $q->is_post_type_archive() ) return; | |
if ( ! is_admin() ) { | |
$q->set( 'tax_query', array(array( | |
'taxonomy' => 'product_cat', | |
'field' => 'slug', | |
'terms' => array( 'PUT YOUR CATEGORY HERE' ), // Don't display products in the membership category on the shop page . For multiple category , separate it with comma. | |
'operator' => 'NOT IN' |
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
// Display 24 products per page. Goes in functions.php | |
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 ); |
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
.woocommerce .woocommerce-tabs ul.tabs {display:none !important} |
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
.star-rating span:before, ul.products li.product .product-details .star-rating:before { | |
content:none; | |
} |
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
/** | |
* Auto Complete all WooCommerce orders. | |
* Add to theme functions.php file | |
*/ | |
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' ); | |
function custom_woocommerce_auto_complete_order( $order_id ) { | |
global $woocommerce; | |
if ( !$order_id ) |
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
/** | |
* 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() { | |
return 'XX'; // country code | |
} |
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_payment_complete_order_status', 'virtual_order_payment_complete_order_status', 10, 2 ); | |
function virtual_order_payment_complete_order_status( $order_status, $order_id ) { | |
$order = new WC_Order( $order_id ); | |
if ( 'processing' == $order_status && | |
( 'on-hold' == $order->status || 'pending' == $order->status || 'failed' == $order->status ) ) { | |
$virtual_order = null; | |
if ( count( $order->get_items() ) > 0 ) { | |
foreach( $order->get_items() as $item ) { | |
if ( 'line_item' == $item['type'] ) { | |
$_product = $order->get_product_from_item( $item ); |
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 checkbox field to the checkout | |
**/ | |
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field'); | |
function my_custom_checkout_field( $checkout ) { | |
echo '<div id="my-new-field"><h3>'.__('My Checkbox: ').'</h3>'; | |
woocommerce_form_field( 'my_checkbox', array( | |
'type' => 'checkbox', | |
'class' => array('input-checkbox'), |