WooCommerce backward compatibility. Fix for #961

`wc_review_ratings_enable` was added in WC 3.6.0. Calling it in WC 3.5.x throws a fatal error. See #961
This commit is contained in:
IanDelMar 2019-04-29 23:42:07 +02:00 committed by GitHub
parent bbae68f083
commit 8b841fb3e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 4 deletions

View File

@ -138,3 +138,27 @@ if ( ! function_exists( 'understrap_wc_form_field_args' ) ) {
return $args;
}
}
if ( ! function_exists( 'wc_review_ratings_enabled' ) ) {
/**
* Check if reviews are enabled.
*
* Function introduced in WooCommerce 3.6.0., include it for backward compatibility.
*
* @return bool
*/
function wc_reviews_enabled() {
return 'yes' === get_option( 'woocommerce_enable_reviews' );
}
/**
* Check if reviews ratings are enabled.
*
* Function introduced in WooCommerce 3.6.0., include it for backward compatibility.
*
* @return bool
*/
function wc_review_ratings_enabled() {
return wc_reviews_enabled() && 'yes' === get_option( 'woocommerce_enable_review_rating' );
}
}