Add products category for free shipping products in woocommerce

I want to have a free shipping category to use it in filter and in link that show the products only that are eligible for free shipping. This an example applying sale filter after adding a category called sale add_action( 'woocommerce_product_query', 'bbloomer_sale_category' ); function bbloomer_sale_category( $q ) { if ( "sale" !== $q->get( 'product_cat' ) ) return; // "sale" = slug $q->set( 'post_type', 'product' ); $q->set( 'product_cat', null ); $product_ids_on_sale = wc_get_product_ids_on_sale() ? wc_get_product_ids_on_sale() : array(); $q->set( 'post__in', $product_ids_on_sale ); } I'm hoping to get the same results but for free shipping.

Comment (0)

You’ll be in good company