Fixed PHP warning on woocommerce_catalog_ordering()
This fixes the follow warning: > PHP Warning: array_key_exists(): The first argument should be either a string or an integer in includes/wc-template-functions.php on line 1012 When an option doesn't exists is returned `false`, just setting a default value to fix the issue. This issue should happen in new installations of WooCommerce 3.3 when no order is defined on the customizer.
This commit is contained in:
parent
db3924f2c7
commit
15989622df
|
@ -992,7 +992,7 @@ if ( ! function_exists( 'woocommerce_catalog_ordering' ) ) {
|
|||
'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' ) );
|
||||
$default_orderby = wc_get_loop_prop( 'is_search' ) ? 'relevance' : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', '' ) );
|
||||
$orderby = isset( $_GET['orderby'] ) ? wc_clean( wp_unslash( $_GET['orderby'] ) ) : $default_orderby; // WPCS: sanitization ok, input var ok, CSRF ok.
|
||||
|
||||
if ( wc_get_loop_prop( 'is_search' ) ) {
|
||||
|
|
Loading…
Reference in New Issue