Create URL Query Parameter to filter categories on the Wholesale Order Form

Are you looking for a way to easily customize multiple Wholesale Order Forms to display different categories?

If you want to display different Wholesale Order Forms, the best way to do so is by using the Wholesale Order Form shortcodes.

However, if you have a lot of product categories and you want an easier way to redirect users with filtered category, an alternative is by using a URL Query Parameter for the Wholesale Order Form.

To do this, you need to add the custom code below on your functions.php. Then you can now create a URL with a query parameter based on your product category.

add_filter( 'wwof_product_args' , function( $args , $filter ) {
	parse_str( parse_url( $_SERVER['HTTP_REFERER'] , PHP_URL_QUERY ) , $output );
	if( isset( $output['cat_slug'] ) ) {
		$args[ 'tax_query' ][] = array(
			'taxonomy' => 'product_cat',
			'field'    => 'slug',
			'terms'    => array( $output['cat_slug'] ),
		);
	}
	return $args;
} , 90 , 2 );

To use this, let’s say you have a product category with a slug “clothing”. Get the URL of your Wholesale Ordering page and add ?cat_slug=clothing at the end. The URL should look something like this:

http://yoursite.com/wholesale-ordering/?cat_slug=clothing

When this link is clicked or visited, it will redirect you to the Wholesale Order Form page filtered under the clothing category.

in WooCommerce Wholesale Order Form

Solve The Big Three Problems With Wholesaling In WooCommerce

Add wholesale pricing to products   Streamline your ordering   Register & manage wholesale customer

Explore The Plugin Suite  

[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet_bg']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']
[data-image-id='gourmet']