Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameshwartlopez/6ca3c75697f187f8a063e9189641e260 to your computer and use it in GitHub Desktop.
Save jameshwartlopez/6ca3c75697f187f8a063e9189641e260 to your computer and use it in GitHub Desktop.
Show featured products first. Before the normal product list. See https://jameshwartlopez.com/plugin/show-featured-products-in-product-category-pages/
<?php
/*
Show featured products first. Before the normal product list
*/
add_action('woocommerce_before_shop_loop', function() {
if(is_product_category()) {
$current_term = get_queried_object();
echo do_shortcode('[featured_products_by_category cat="'.$current_term->slug.'" limit=3]');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment