diff --git a/includes/api/class-wc-rest-customers-controller.php b/includes/api/class-wc-rest-customers-controller.php
index 46bbc979d7c..33e4f098a4e 100644
--- a/includes/api/class-wc-rest-customers-controller.php
+++ b/includes/api/class-wc-rest-customers-controller.php
@@ -93,7 +93,7 @@ class WC_REST_Customers_Controller extends WC_REST_Customers_V1_Controller {
/**
* Update customer meta fields.
*
- * @param WC_Customer $customer Cusotmer data.
+ * @param WC_Customer $customer Customer data.
* @param WP_REST_Request $request Request data.
*/
protected function update_customer_meta_fields( $customer, $request ) {
diff --git a/includes/api/legacy/v3/class-wc-api-reports.php b/includes/api/legacy/v3/class-wc-api-reports.php
index 2d591af9077..552fd253fda 100644
--- a/includes/api/legacy/v3/class-wc-api-reports.php
+++ b/includes/api/legacy/v3/class-wc-api-reports.php
@@ -317,13 +317,14 @@ class WC_API_Reports extends WC_API_Resource {
*/
protected function validate_request( $id = null, $type = null, $context = null ) {
- if ( ! current_user_can( 'view_woocommerce_reports' ) ) {
-
- return new WP_Error( 'woocommerce_api_user_cannot_read_report', __( 'You do not have permission to read this report', 'woocommerce' ), array( 'status' => 401 ) );
-
- } else {
-
+ if ( current_user_can( 'view_woocommerce_reports' ) ) {
return true;
}
+
+ return new WP_Error(
+ 'woocommerce_api_user_cannot_read_report',
+ __( 'You do not have permission to read this report', 'woocommerce' ),
+ array( 'status' => 401 )
+ );
}
}
diff --git a/includes/class-wc-checkout.php b/includes/class-wc-checkout.php
index b9236b64390..e0ec3d204d1 100644
--- a/includes/class-wc-checkout.php
+++ b/includes/class-wc-checkout.php
@@ -1017,6 +1017,10 @@ class WC_Checkout {
throw new Exception( $order_id->get_error_message() );
}
+ if ( ! $order ) {
+ throw new Exception( __( 'Unable to create order.', 'woocommerce' ) );
+ }
+
do_action( 'woocommerce_checkout_order_processed', $order_id, $posted_data, $order );
if ( WC()->cart->needs_payment() ) {
diff --git a/includes/class-wc-privacy-exporters.php b/includes/class-wc-privacy-exporters.php
index dac586fc739..2868e3b6459 100644
--- a/includes/class-wc-privacy-exporters.php
+++ b/includes/class-wc-privacy-exporters.php
@@ -63,7 +63,7 @@ class WC_Privacy_Exporters {
}
/**
- * Finds and exports data which could be used to identify a person from WooCommerce data assocated with an email address.
+ * Finds and exports data which could be used to identify a person from WooCommerce data associated with an email address.
*
* Orders are exported in blocks of 10 to avoid timeouts.
*
diff --git a/includes/wc-order-functions.php b/includes/wc-order-functions.php
index e4073be5a86..dd9a83bfe99 100644
--- a/includes/wc-order-functions.php
+++ b/includes/wc-order-functions.php
@@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit;
*
* @since 2.6.0
* @param array $args Array of args (above).
- * @return array|stdClass Number of pages and an array of order objects if
+ * @return WC_Order[]|stdClass Number of pages and an array of order objects if
* paginate is true, or just an array of values.
*/
function wc_get_orders( $args ) {
diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php
index b72453f920e..7497098084d 100644
--- a/includes/wc-template-functions.php
+++ b/includes/wc-template-functions.php
@@ -792,7 +792,7 @@ function wc_terms_and_conditions_page_content() {
/**
* Output privacy policy text. This is custom text which can be added via the customizer/privacy settings section.
*
- * Loads the relevent policy for the current page unless a specfic policy text is required.
+ * Loads the relevant policy for the current page unless a specific policy text is required.
*
* @since 3.4.0
* @param string $type Type of policy to load. Valid values include registration and checkout.
@@ -823,7 +823,7 @@ function wc_privacy_policy_text( $type = '' ) {
* @return string
*/
function wc_replace_policy_page_link_placeholders( $text ) {
- $privacy_page_id = wc_privacy_policy_page_id( $text );
+ $privacy_page_id = wc_privacy_policy_page_id();
$terms_page_id = wc_terms_and_conditions_page_id();
$privacy_link = $privacy_page_id ? '' . __( 'privacy policy', 'woocommerce' ) . '' : __( 'privacy policy', 'woocommerce' );
$terms_link = $terms_page_id ? '' . __( 'terms and conditions', 'woocommerce' ) . '' : __( 'terms and conditions', 'woocommerce' );