Last active
December 15, 2015 05:39
-
-
Save growdev/5210074 to your computer and use it in GitHub Desktop.
WooCommerce 2.0.4 - Change number of columns of thumbnails for Up Sells on product page.
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 | |
// first remove the action defined in woocommerce-hooks.php | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); | |
// modeled off of the woocommerce_upsell_display() function in woocommerce-template.php | |
// change $columns to desired number of columns | |
function my_woocommerce_upsell_display( $posts_per_page = '-1', $columns = 5, $orderby = 'rand' ) { | |
woocommerce_get_template( 'single-product/up-sells.php', array( | |
'posts_per_page' => $posts_per_page, | |
'orderby' => $orderby, | |
'columns' => $columns | |
) ); | |
} | |
// re-add the action for display | |
add_action( 'woocommerce_after_single_product_summary', 'my_woocommerce_upsell_display', 15 ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment