{"id":939,"date":"2016-12-02T20:20:49","date_gmt":"2016-12-02T14:50:49","guid":{"rendered":"http:\/\/www.magewallet.com\/?p=939"},"modified":"2020-03-13T16:04:36","modified_gmt":"2020-03-13T10:34:36","slug":"change-default-sort-order-magento-2","status":"publish","type":"post","link":"https:\/\/www.hiddentechies.com\/blog\/magento-2\/change-default-sort-order-magento-2\/","title":{"rendered":"How to change default sort order from ascending to descending in Magento 2?"},"content":{"rendered":"<p>In order to change default sort order from ascending to descending in Magento 2, first you need to copy <b>vendor\/magento\/module-catalog\/view\/frontend\/layout\/catalog_category_view.xml<\/b><\/p>\n<p>to<\/p>\n<p><b>app\/design\/frontend\/{{Vender_Namespace}}\/{{Theme_Name}}\/Magento_Catalog\/layout\/catalog_category_view.xml<\/b> into your theme.<\/p>\n<p>Now copy below code to your new xml file.<\/p>\n<pre class=\"lang:default decode:true \">&lt;?xml version=\"1.0\"?&gt;\r\n&lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" layout=\"2columns-left\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\"&gt;\r\n    &lt;body&gt;\r\n        &lt;referenceContainer name=\"content\"&gt;\r\n            &lt;referenceBlock class=\"Magento\\Catalog\\Block\\Product\\ListProduct\" name=\"category.products.list\" as=\"product_list\"&gt;\r\n                &lt;action method=\"setDefaultDirection\"&gt;\r\n                    &lt;argument name=\"dir\" xsi:type=\"string\"&gt;desc&lt;\/argument&gt;\r\n                &lt;\/action&gt;\r\n            &lt;\/referenceBlock&gt;\r\n        &lt;\/referenceContainer&gt;\r\n        &lt;move element=\"category.view.container\" destination=\"content\" before=\"-\"\/&gt;\r\n    &lt;\/body&gt;\r\n&lt;\/page&gt;<\/pre>\n<p>Ref: <a href=\"http:\/\/magento.stackexchange.com\/questions\/119642\/magento2-default-to-sort-by-price-descending-not-ascending\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/magento.stackexchange.com\/questions\/119642\/magento2-default-to-sort-by-price-descending-not-ascending<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to change default sort order from ascending to descending in Magento 2, first you need to copy vendor\/magento\/module-catalog\/view\/frontend\/layout\/catalog_category_view.xml to app\/design\/frontend\/{{Vender_Namespace}}\/{{Theme_Name}}\/Magento_Catalog\/layout\/catalog_category_view.xml into your theme. Now copy below code to your new xml file. &lt;?xml version=&#8221;1.0&#8243;?&gt; &lt;page xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; layout=&#8221;2columns-left&#8221; xsi:noNamespaceSchemaLocation=&#8221;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&#8221;&gt; &lt;body&gt; &lt;referenceContainer name=&#8221;content&#8221;&gt; &lt;referenceBlock class=&#8221;Magento\\Catalog\\Block\\Product\\ListProduct&#8221; name=&#8221;category.products.list&#8221; as=&#8221;product_list&#8221;&gt; &lt;action method=&#8221;setDefaultDirection&#8221;&gt; &lt;argument name=&#8221;dir&#8221; xsi:type=&#8221;string&#8221;&gt;desc&lt;\/argument&gt; &lt;\/action&gt; &lt;\/referenceBlock&gt; &lt;\/referenceContainer&gt;&#8230; <\/p>\n<div class=\"actions\"><a href=\"https:\/\/www.hiddentechies.com\/blog\/magento-2\/change-default-sort-order-magento-2\/\">Continue Reading<\/a><\/div>\n","protected":false},"author":1,"featured_media":4823,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[134,135,9,10,45,136],"_links":{"self":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/939"}],"collection":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/comments?post=939"}],"version-history":[{"count":4,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/939\/revisions"}],"predecessor-version":[{"id":10527,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/939\/revisions\/10527"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media\/4823"}],"wp:attachment":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media?parent=939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/categories?post=939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/tags?post=939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}