Okay
  Public Ticket #4521801
Tiered pricing backend order changed
Closed

Comments

  •  18
    Darren Robinson started the conversation

    Hi Stefan,


    When opening a product in the backend to edit today the tiered pricing section has randomly changed  order. It used to have the group corporate prices then trade group prices and then wholesale group prices but now the wholesale group tiered pricing section has randomly moved to the top?


    Thanks

    Darren

  •  2,619
    WebWizards replied

    Hi Darren,

    We recently made some changes to the group ordering as we're preparing a new UI that will have drag & drop and sorting for groups. It's not available yet, but in the meantime you can control the order by adding this PHP code snippet to functions.php of your theme or a code snippets plugin:

    add_filter('b2bking_group_post_type_supports', function($arr){
    	$arr[] = 'page-attributes';
    	return $arr;
    }, 10, 1);
    
    add_filter( 'pre_get_posts', 'b2bking_group_default_sort_order' );
    function b2bking_group_default_sort_order( $query ) {
        if ( is_admin() && $query->is_main_query() && $query->get('post_type') === 'b2bking_group' ) {
            $query->set( 'orderby', 'menu_order' );
            $query->set( 'order', 'ASC' );
        }
    }

    Once you add that, when you edit each group you'll see a "Post Attributes" metabox with an Order input field where you can enter a number (0, 1, 2, 3, etc.) to set the order of that group in the backend pricing sections.

     

    Kind regards,
    Stefan

  •  18
    Darren Robinson replied

    Thanks Stefan, I will wait until the new feature lets me drag and drop.


    Thanks

    Darren