Skip to content

Instantly share code, notes, and snippets.

@kloon
Created March 15, 2013 08:34
Show Gist options
  • Save kloon/5168345 to your computer and use it in GitHub Desktop.
Save kloon/5168345 to your computer and use it in GitHub Desktop.
WooCommerce Product Up-Sells Shortcode
<?php
add_shortcode( 'product_upsells', 'wc_upsells_shortcode' );
function wc_upsells_shortcode( $atts ) {
extract( shortcode_atts( array(
'posts_per_page' => '-1',
'columns' => '2',
'orderby' => 'rand'
), $atts ) );
woocommerce_get_template( 'single-product/up-sells.php', array(
'posts_per_page' => $posts_per_page,
'orderby' => $orderby,
'columns' => $columns
) );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment