Can I change the order of categories in the vendor refinement search?

Hi.

Always Thank you for your awesome plugin.

In my question is :

Could I change the order of vendor’s category?

I think that Listing’s categories can change the orders.
But There isn’t the orders of categories in vendor filter.

How do I change the order of categories in vendor filter?

Hi,

This is possible, but will require an additional PHP snippet to the hivepress/v1/forms/vendor_filter hook How to add custom code snippets - HivePress Help Center.

Hi!

Thank you for your reply.
But I can’t do it.

I can change the order between the categories and the tags.
And I want to change the order of each category.

For example, I want to change the order of the attachment images’ Green arrow and Red arrow.

In this case, what code should I write?

I tried once with the code below, but I couldn’t do it.

add_filter(
	'hivepress/v1/forms/vendor_filter',
	function($form) {
		$form['fields']['categories']['tyugoku']['_order'] = 100;
		$form['fields']['categories']['tyuubu']['_order'] = 1;
		return $form;
	},
	1000
);

P.S. The “tyugoku” and “tyuubu” in the code refer to the slug names of the Green arrow and Red arrow.

Please try this PHP code snippet. Then it is needed to re-save all vendor categories, and it is possible to set category orders in Vendors/Categories in the admin panel of your website. But please note that it can require further advanced customization.

add_filter(
	'hivepress/v1/meta_boxes',
	function($meta_boxes){
		$meta_boxes['vendor_category_settings'] = [
			'screen' => 'vendor_category',

			'fields' => [
				'sort_order'            => [
					'label'     => 'Order',
					'type'      => 'number',
					'min_value' => 0,
					'default'   => 0,
					'required'  => true,
					'_order'    => 20,
				],
			],
		];
		
		return $meta_boxes;
	},
	1000
);

Thank you!

I can become do this!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.