WooCommerce Gutenberg Products Block - Version 1.1.1

Version Description

  • 2018-08-22 =
  • Fix - Make Newness ordering order correctly on frontend.
  • Fix - Don't cause fatal errors if WooCommerce is not active.
Download this release

Release Info

Developer claudiulodro
Plugin Icon 128x128 WooCommerce Gutenberg Products Block
Version 1.1.1
Comparing to
See all releases

Code changes from version 1.1.0 to 1.1.1

assets/js/products-block.js CHANGED
@@ -1195,6 +1195,9 @@ registerBlockType('woocommerce/products', {
1195
  } else if ('price_asc' === orderby) {
1196
  shortcode_atts.set('orderby', 'price');
1197
  shortcode_atts.set('order', 'ASC');
 
 
 
1198
  } else {
1199
  shortcode_atts.set('orderby', orderby);
1200
  }
1195
  } else if ('price_asc' === orderby) {
1196
  shortcode_atts.set('orderby', 'price');
1197
  shortcode_atts.set('order', 'ASC');
1198
+ } else if ('date' === orderby) {
1199
+ shortcode_atts.set('orderby', 'date');
1200
+ shortcode_atts.set('order', 'DESC');
1201
  } else {
1202
  shortcode_atts.set('orderby', orderby);
1203
  }
assets/js/products-block.jsx CHANGED
@@ -74,8 +74,8 @@ const PRODUCTS_BLOCK_DISPLAY_SETTINGS = {
74
  * @return bool
75
  */
76
  function supportsOrderby( display ) {
77
- return ! ( PRODUCTS_BLOCK_DISPLAY_SETTINGS.hasOwnProperty( display )
78
- && PRODUCTS_BLOCK_DISPLAY_SETTINGS[ display ].hasOwnProperty( 'no_orderby' )
79
  && PRODUCTS_BLOCK_DISPLAY_SETTINGS[ display ].no_orderby );
80
  }
81
 
@@ -834,6 +834,9 @@ registerBlockType( 'woocommerce/products', {
834
  } else if ( 'price_asc' === orderby ) {
835
  shortcode_atts.set( 'orderby', 'price' );
836
  shortcode_atts.set( 'order', 'ASC' )
 
 
 
837
  } else {
838
  shortcode_atts.set( 'orderby', orderby );
839
  }
74
  * @return bool
75
  */
76
  function supportsOrderby( display ) {
77
+ return ! ( PRODUCTS_BLOCK_DISPLAY_SETTINGS.hasOwnProperty( display )
78
+ && PRODUCTS_BLOCK_DISPLAY_SETTINGS[ display ].hasOwnProperty( 'no_orderby' )
79
  && PRODUCTS_BLOCK_DISPLAY_SETTINGS[ display ].no_orderby );
80
  }
81
 
834
  } else if ( 'price_asc' === orderby ) {
835
  shortcode_atts.set( 'orderby', 'price' );
836
  shortcode_atts.set( 'order', 'ASC' )
837
+ } else if ( 'date' === orderby ) {
838
+ shortcode_atts.set( 'orderby', 'date' );
839
+ shortcode_atts.set( 'order', 'DESC' )
840
  } else {
841
  shortcode_atts.set( 'orderby', orderby );
842
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: gutenberg, woocommerce, woo commerce, products
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
  Requires PHP: 5.2
7
- Stable tag: 1.1.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -53,6 +53,10 @@ Yes you can! Join in on our [GitHub repository](https://github.com/woocommerce/w
53
 
54
  == Changelog ==
55
 
 
 
 
 
56
  = 1.1.0 - 2018-06-06 =
57
  * Feature - Add "Best Selling" and "Top Rated" product scopes.
58
  * Fix - Only enqueue scripts and styles in the site backend.
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
  Requires PHP: 5.2
7
+ Stable tag: 1.1.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
53
 
54
  == Changelog ==
55
 
56
+ == 1.1.1 - 2018-08-22 =
57
+ * Fix - Make Newness ordering order correctly on frontend.
58
+ * Fix - Don't cause fatal errors if WooCommerce is not active.
59
+
60
  = 1.1.0 - 2018-06-06 =
61
  * Feature - Add "Best Selling" and "Top Rated" product scopes.
62
  * Fix - Only enqueue scripts and styles in the site backend.
woocommerce-gutenberg-products-block.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce Gutenberg Products Block
4
  * Plugin URI: https://github.com/woocommerce/woocommerce-gutenberg-products-block
5
  * Description: WooCommerce Products block for the Gutenberg editor.
6
- * Version: 1.1.0
7
  * Author: Automattic
8
  * Author URI: https://woocommerce.com
9
  * Text Domain: woocommerce
@@ -14,7 +14,7 @@
14
 
15
  defined( 'ABSPATH' ) || die();
16
 
17
- define( 'WGPB_VERSION', '1.1.0' );
18
 
19
  /**
20
  * Load up the assets if Gutenberg is active.
@@ -43,6 +43,10 @@ function wgpb_register_products_block() {
43
  * Register extra scripts needed.
44
  */
45
  function wgpb_extra_gutenberg_scripts() {
 
 
 
 
46
  wp_enqueue_script(
47
  'react-transition-group',
48
  plugins_url( 'assets/js/vendor/react-transition-group.js', __FILE__ ),
3
  * Plugin Name: WooCommerce Gutenberg Products Block
4
  * Plugin URI: https://github.com/woocommerce/woocommerce-gutenberg-products-block
5
  * Description: WooCommerce Products block for the Gutenberg editor.
6
+ * Version: 1.1.1
7
  * Author: Automattic
8
  * Author URI: https://woocommerce.com
9
  * Text Domain: woocommerce
14
 
15
  defined( 'ABSPATH' ) || die();
16
 
17
+ define( 'WGPB_VERSION', '1.1.1' );
18
 
19
  /**
20
  * Load up the assets if Gutenberg is active.
43
  * Register extra scripts needed.
44
  */
45
  function wgpb_extra_gutenberg_scripts() {
46
+ if ( ! function_exists( 'wc_get_theme_support' ) ) {
47
+ return;
48
+ }
49
+
50
  wp_enqueue_script(
51
  'react-transition-group',
52
  plugins_url( 'assets/js/vendor/react-transition-group.js', __FILE__ ),