Skip to content

Instantly share code, notes, and snippets.

@lukecav
lukecav / functions.php
Created September 28, 2017 19:20
Filter by featured products in wp-admin when using WooCommerce
add_action('restrict_manage_posts', 'featured_products_sorting');
function featured_products_sorting() {
global $typenow;
$post_type = 'product'; // change to your post type
$taxonomy = 'product_visibility'; // change to your taxonomy
if ($typenow == $post_type) {
$selected = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : '';
$info_taxonomy = get_taxonomy($taxonomy);
wp_dropdown_categories(array(
'show_option_all' => __("Show all {$info_taxonomy->label}"),
@bekarice
bekarice / wc-sku-sorting.php
Last active April 8, 2024 17:56
Sort WooCommerce Products by SKU
<?php // ONLY COPY THIS LINE IF NEEDED!
/**
* Adds the ability to sort products in the shop based on the SKU
* Can be combined with tips here to display the SKU on the shop page: https://www.skyverge.com/blog/add-information-to-woocommerce-shop-page/
*
* @param array $args the sorting args
* @return array updated args
*/
function sv_add_sku_sorting( $args ) {
@mikejolley
mikejolley / gist:1597957
Created January 12, 2012 01:40
WooCommerce - Replace '' with 'Call for price' when price is left blank
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_empty_price_html', 'custom_call_for_price');
function custom_call_for_price() {
return 'Call for price';
}