woocommerce_default_catalog_orderby

woocommerce_default_catalog_orderby

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_default_catalog_orderby') is found 3 times:

  • /includes/class-wc-query.php line 596
    			if ( ! $orderby_value ) {
    				if ( is_search() ) {
    					$orderby_value = 'relevance';
    				} else {
    					$orderby_value = apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', 'menu_order' ) );
    				}
    			}
    
    			// Get order + orderby args from string.
    			$orderby_value = is_array( $orderby_value ) ? $orderby_value : explode( '-', $orderby_value );
    			$orderby       = esc_attr( $orderby_value[0] );
    
  • /includes/wc-template-functions.php line 1487
    	function woocommerce_catalog_ordering() {
    		if ( ! wc_get_loop_prop( 'is_paginated' ) || ! woocommerce_products_will_display() ) {
    			return;
    		}
    		$show_default_orderby    = 'menu_order' === apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', 'menu_order' ) );
    		$catalog_orderby_options = apply_filters(
    			'woocommerce_catalog_orderby',
    			array(
    				'menu_order' => __( 'Default sorting', 'woocommerce' ),
    				'popularity' => __( 'Sort by popularity', 'woocommerce' ),
    				'rating'     => __( 'Sort by average rating', 'woocommerce' ),
    
  • /includes/wc-template-functions.php line 1500
    				'price-desc' => __( 'Sort by price: high to low', 'woocommerce' ),
    			)
    		);
    
    		$default_orderby = wc_get_loop_prop( 'is_search' ) ? 'relevance' : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', '' ) );
    		// phpcs:disable WordPress.Security.NonceVerification.Recommended
    		$orderby = isset( $_GET['orderby'] ) ? wc_clean( wp_unslash( $_GET['orderby'] ) ) : $default_orderby;
    		// phpcs:enable WordPress.Security.NonceVerification.Recommended
    
    		if ( wc_get_loop_prop( 'is_search' ) ) {
    			$catalog_orderby_options = array_merge( array( 'relevance' => __( 'Relevance', 'woocommerce' ) ), $catalog_orderby_options );