Woocommerce Cheat Sheet

Increase Your PHP Memory

Add this to wp-config.php

// Increase PHP Memory as recommended by Woocommerce
define( ‘WP_MEMORY_LIMIT’, ’64M’ );

Move WooCommerce Product Tabs under Product Summary

Add this to functions.php

// Remove tabs from the original location
remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_product_data_tabs’, 10 );

 

// Insert tabs under Product Summary
add_action( ‘woocommerce_single_product_summary’, ‘woocommerce_output_product_data_tabs’, 60 );

Remove sidebar from Woocommerce

Remove this from wp-content/plugins/woocommerce/single-product.php

<?php
/**
* woocommerce_sidebar hook
* @hooked woocommerce_get_sidebar – 10
*/
do_action(‘woocommerce_sidebar’);
?>

Remove this from wp-content/plugins/woocommerce/archive-product.php

<?php
/**
* woocommerce_sidebar hook
* @hooked woocommerce_get_sidebar – 10
*/
do_action(‘woocommerce_sidebar’);
?>

Add this to style.css

#content-woocommerce {
width:100%;
}

Change the number of Woocommerce related products and columns

Add this to functions.php

<?php
/**
* Change number of related products on product page
* Set your own value for ‘posts_per_page’
*/
function woo_related_products_limit() {
global $product;

$args[‘posts_per_page’] = 6;
return $args;
}
add_filter( ‘woocommerce_output_related_products_args’, ‘jk_related_products_args’ );
function jk_related_products_args( $args ) {
$args[‘posts_per_page’] = 3; // 3 related products
$args[‘columns’] = 3; // arranged in 3 columns
return $args;
}