Merge pull request woocommerce/woocommerce-blocks#105 from woocommerce/fix/101

Add order DESC attribute when ordering by newest first
This commit is contained in:
Claudiu Lodromanean 2018-08-22 10:37:16 -07:00 committed by GitHub
commit 89794358e6
2 changed files with 8 additions and 2 deletions

View File

@ -1195,6 +1195,9 @@ registerBlockType('woocommerce/products', {
} else if ('price_asc' === orderby) { } else if ('price_asc' === orderby) {
shortcode_atts.set('orderby', 'price'); shortcode_atts.set('orderby', 'price');
shortcode_atts.set('order', 'ASC'); shortcode_atts.set('order', 'ASC');
} else if ('date' === orderby) {
shortcode_atts.set('orderby', 'date');
shortcode_atts.set('order', 'DESC');
} else { } else {
shortcode_atts.set('orderby', orderby); shortcode_atts.set('orderby', orderby);
} }

View File

@ -834,6 +834,9 @@ registerBlockType( 'woocommerce/products', {
} else if ( 'price_asc' === orderby ) { } else if ( 'price_asc' === orderby ) {
shortcode_atts.set( 'orderby', 'price' ); shortcode_atts.set( 'orderby', 'price' );
shortcode_atts.set( 'order', 'ASC' ) shortcode_atts.set( 'order', 'ASC' )
} else if ( 'date' === orderby ) {
shortcode_atts.set( 'orderby', 'date' );
shortcode_atts.set( 'order', 'DESC' )
} else { } else {
shortcode_atts.set( 'orderby', orderby ); shortcode_atts.set( 'orderby', orderby );
} }