- No categories
- All
custom attributes sort doesn’t work on search page
i'm using aws pro search plugin and i have sort by custom attributes, it works fine on product page but on the search result it doesn't show the right order, it's a sort by a string attributes and i want it to be in alphabetic order, i found some code on the internet i tried to change but it doesn't show anything function custom_woocommerce_get_catalog_ordering_args( $args ) { global $wp_query; // Changed the $_SESSION to $_GET if (isset($_GET['orderby'])) { switch ($_GET['orderby']) : case 'auteur-asc' : $args['order'] = 'ASC'; $args['meta_key'] = 'pa_auteur'; $args['orderby'] = 'meta_value'; break; endswitch; } return $args; } function custom_woocommerce_catalog_orderby( $sortby ) { $sortby['auteur-asc'] = 'Sort by Auteur: A to Z'; return $sortby; } function wh_save_product_custom_meta($post_id, $post, $update) { $post_type = get_post_type($post_id); // If this isn't a 'product' post, don't update it. if ($post_type != 'product') return; if (!empty($_POST['attribute_names']) … [Read more...] about custom attributes sort doesn’t work on search page
Learn More