Skip to content

Instantly share code, notes, and snippets.

#nav-search .icon-search {
position: absolute;
right: 9px;
}
#nav-search {
margin-right: 9px;
top: 10px;
padding-top:5px;
@nickburne
nickburne / gist:11251252
Created April 24, 2014 11:33
remove the orderby dropdown for products
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
@nickburne
nickburne / Remove product tabs
Created April 24, 2014 11:36
Remove product tabs
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab
@nickburne
nickburne / Remove the orderby dropdown for products
Created April 28, 2014 13:10
Remove the orderby dropdown for products
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
@nickburne
nickburne / Re-order the product tabs
Created April 28, 2014 13:18
Re-order the product tabs
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {
$tabs['reviews']['priority'] = 5; // Reviews first
$tabs['description']['priority'] = 10; // Description second
$tabs['additional_information']['priority'] = 15; // Additional information third
return $tabs;
@nickburne
nickburne / Change the Woocommerce star ratings to show stars
Created April 28, 2014 13:21
Change the Woocommerce star ratings to show stars
.star-rating{float:right;width:80px;height:16px;background:url(images/star.png) repeat-x left 0}
.star-rating span{background:url(images/star.png) repeat-x left -32px;height:0;padding-top:16px;overflow:hidden;float:left}
.hreview-aggregate .star-rating{margin:10px 0 0 0}
#review_form #respond{position:static;margin:0;width:auto;padding:0 0 0;background:transparent none;border:0}
#review_form #respond:after{content:"";display:block;clear:both}
#review_form #respond p{margin:0 0 10px}
#review_form #respond .form-submit input{left:auto}
#review_form #respond textarea{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%}
p.stars:after{content:"";display:block;clear:both}
p.stars span{width:80px;height:16px;position:relative;float:left;background:url(images/star.png) repeat-x left 0}
@nickburne
nickburne / Remove specific (or all) of the product tabs
Created April 28, 2014 13:23
Remove specific (or all) of the product tabs
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab
return $tabs;
@nickburne
nickburne / Personalise a product tab to say exactly what you want
Created April 28, 2014 13:31
Personalise a product tab to say exactly what you want
add_filter( 'woocommerce_product_tabs', 'woo_custom_description_tab', 98 );
function woo_custom_description_tab( $tabs ) {
$tabs['description']['callback'] = 'woo_custom_description_tab_content'; // Custom description callback
return $tabs;
}
@nickburne
nickburne / Show the product description underneath an image
Created April 28, 2014 13:33
Show the product description underneath an image
add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5);
@nickburne
nickburne / Automatically add product to cart on visit
Created April 28, 2014 13:34
Automatically add product to cart on visit
* goes in theme functions.php or a custom plugin
// add item to cart on visit
add_action( 'init', 'add_product_to_cart' );
function add_product_to_cart() {
if ( ! is_admin() ) {
global $woocommerce;
$product_id = 64;
$found = false;
//check if product already in cart
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) {