Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace
This commit is contained in:
parent
c6a87301c1
commit
2346c3b735
|
@ -1256,8 +1256,7 @@ class WC_Admin_Post_Types {
|
|||
if ( ! empty( $_REQUEST['_sold_individually'] ) ) {
|
||||
if ( $_REQUEST['_sold_individually'] == 'yes' ) {
|
||||
update_post_meta( $post_id, '_sold_individually', 'yes' );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
update_post_meta( $post_id, '_sold_individually', '' );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -311,13 +311,11 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
|||
// Null when the order was refunded, but not the line items themselves.
|
||||
$this->report_data->total_tax_refunded += ( $value->total_tax * -1 );
|
||||
$this->report_data->total_refunds += $value->total_refund;
|
||||
}
|
||||
elseif ( 'shipping' === $value->item_type ) {
|
||||
} elseif ( 'shipping' === $value->item_type ) {
|
||||
$this->report_data->total_shipping_tax_refunded += ( $value->total_shipping_tax * -1 );
|
||||
$this->report_data->total_shipping_refunded += wc_format_decimal( $value->total_refund, 2 );
|
||||
$this->report_data->total_refunds += $value->total_refund;
|
||||
}
|
||||
elseif ( 'line_item' === $value->item_type ) {
|
||||
} elseif ( 'line_item' === $value->item_type ) {
|
||||
$this->report_data->total_tax_refunded += ( $value->total_tax * -1 );
|
||||
$this->report_data->refunded_order_items += absint( $value->order_item_count );
|
||||
$this->report_data->total_refunds += $value->total_refund;
|
||||
|
|
|
@ -1451,7 +1451,7 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
|
|||
|
||||
if ( isset( $variation['stock_quantity'] ) ) {
|
||||
wc_update_product_stock( $variation_id, wc_stock_amount( $variation['stock_quantity'] ) );
|
||||
} elseif ( isset( $request['inventory_delta'] ) ) {
|
||||
} elseif ( isset( $request['inventory_delta'] ) ) {
|
||||
$stock_quantity = wc_stock_amount( get_post_meta( $variation_id, '_stock', true ) );
|
||||
$stock_quantity += wc_stock_amount( $request['inventory_delta'] );
|
||||
|
||||
|
|
|
@ -344,8 +344,7 @@ class WC_API_Server {
|
|||
if ( $supported & self::ACCEPT_DATA ) {
|
||||
$data = $this->handler->parse_body( $this->get_raw_data() );
|
||||
$args = array_merge( $args, array( 'data' => $data ) );
|
||||
}
|
||||
elseif ( $supported & self::ACCEPT_RAW_DATA ) {
|
||||
} elseif ( $supported & self::ACCEPT_RAW_DATA ) {
|
||||
$data = $this->get_raw_data();
|
||||
$args = array_merge( $args, array( 'data' => $data ) );
|
||||
}
|
||||
|
@ -398,12 +397,10 @@ class WC_API_Server {
|
|||
if ( isset( $provided[ $param->getName() ] ) ) {
|
||||
// We have this parameters in the list to choose from
|
||||
$ordered_parameters[] = is_array( $provided[ $param->getName() ] ) ? array_map( 'urldecode', $provided[ $param->getName() ] ) : urldecode( $provided[ $param->getName() ] );
|
||||
}
|
||||
elseif ( $param->isDefaultValueAvailable() ) {
|
||||
} elseif ( $param->isDefaultValueAvailable() ) {
|
||||
// We don't have this parameter, but it's optional
|
||||
$ordered_parameters[] = $param->getDefaultValue();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// We don't have this parameter and it wasn't optional, abort!
|
||||
return new WP_Error( 'woocommerce_api_missing_callback_param', sprintf( __( 'Missing parameter %s', 'woocommerce' ), $param->getName() ), array( 'status' => 400 ) );
|
||||
}
|
||||
|
@ -709,8 +706,7 @@ class WC_API_Server {
|
|||
foreach ( $server as $key => $value ) {
|
||||
if ( strpos( $key, 'HTTP_' ) === 0 ) {
|
||||
$headers[ substr( $key, 5 ) ] = $value;
|
||||
}
|
||||
elseif ( isset( $additional[ $key ] ) ) {
|
||||
} elseif ( isset( $additional[ $key ] ) ) {
|
||||
$headers[ $key ] = $value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -537,10 +537,9 @@ class WC_API_Coupons extends WC_API_Resource {
|
|||
} else {
|
||||
$coupons[] = $edit['coupon'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Coupon don't exists / create coupon
|
||||
else {
|
||||
// Coupon don't exists / create coupon
|
||||
$new = $this->create_coupon( array( 'coupon' => $_coupon ) );
|
||||
|
||||
if ( is_wp_error( $new ) ) {
|
||||
|
|
|
@ -821,10 +821,8 @@ class WC_API_Customers extends WC_API_Resource {
|
|||
} else {
|
||||
$customers[] = $edit['customer'];
|
||||
}
|
||||
}
|
||||
|
||||
// Customer don't exists / create customer
|
||||
else {
|
||||
} else {
|
||||
// Customer don't exists / create customer
|
||||
$new = $this->create_customer( array( 'customer' => $_customer ) );
|
||||
|
||||
if ( is_wp_error( $new ) ) {
|
||||
|
|
|
@ -1785,10 +1785,8 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
} else {
|
||||
$orders[] = $edit['order'];
|
||||
}
|
||||
}
|
||||
|
||||
// Order don't exists / create order
|
||||
else {
|
||||
} else {
|
||||
// Order don't exists / create order
|
||||
$new = $this->create_order( array( 'order' => $_order ) );
|
||||
|
||||
if ( is_wp_error( $new ) ) {
|
||||
|
|
|
@ -2415,8 +2415,9 @@ class WC_API_Products extends WC_API_Resource {
|
|||
$product_id = wc_get_product_id_by_sku( $product_sku );
|
||||
}
|
||||
|
||||
// Product exists / edit product
|
||||
if ( $product_id ) {
|
||||
|
||||
// Product exists / edit product
|
||||
$edit = $this->edit_product( $product_id, array( 'product' => $_product ) );
|
||||
|
||||
if ( is_wp_error( $edit ) ) {
|
||||
|
@ -2428,10 +2429,9 @@ class WC_API_Products extends WC_API_Resource {
|
|||
} else {
|
||||
$products[] = $edit['product'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Product don't exists / create product
|
||||
else {
|
||||
// Product don't exists / create product
|
||||
$new = $this->create_product( array( 'product' => $_product ) );
|
||||
|
||||
if ( is_wp_error( $new ) ) {
|
||||
|
|
|
@ -154,14 +154,16 @@ class WC_API_Server {
|
|||
// allow plugins to remove default authentication or add their own authentication
|
||||
$user = apply_filters( 'woocommerce_api_check_authentication', null, $this );
|
||||
|
||||
// API requests run under the context of the authenticated user
|
||||
if ( is_a( $user, 'WP_User' ) ) {
|
||||
wp_set_current_user( $user->ID );
|
||||
}
|
||||
|
||||
// WP_Errors are handled in serve_request()
|
||||
elseif ( ! is_wp_error( $user ) ) {
|
||||
// API requests run under the context of the authenticated user
|
||||
wp_set_current_user( $user->ID );
|
||||
|
||||
} elseif ( ! is_wp_error( $user ) ) {
|
||||
|
||||
// WP_Errors are handled in serve_request()
|
||||
$user = new WP_Error( 'woocommerce_api_authentication_error', __( 'Invalid authentication method', 'woocommerce' ), array( 'code' => 500 ) );
|
||||
|
||||
}
|
||||
|
||||
return $user;
|
||||
|
|
|
@ -525,8 +525,9 @@ class WC_API_Coupons extends WC_API_Resource {
|
|||
$coupon_id = intval( $_coupon['id'] );
|
||||
}
|
||||
|
||||
// Coupon exists / edit coupon
|
||||
if ( $coupon_id ) {
|
||||
|
||||
// Coupon exists / edit coupon
|
||||
$edit = $this->edit_coupon( $coupon_id, array( 'coupon' => $_coupon ) );
|
||||
|
||||
if ( is_wp_error( $edit ) ) {
|
||||
|
@ -537,10 +538,9 @@ class WC_API_Coupons extends WC_API_Resource {
|
|||
} else {
|
||||
$coupons[] = $edit['coupon'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Coupon don't exists / create coupon
|
||||
else {
|
||||
// Coupon don't exists / create coupon
|
||||
$new = $this->create_coupon( array( 'coupon' => $_coupon ) );
|
||||
|
||||
if ( is_wp_error( $new ) ) {
|
||||
|
|
|
@ -798,8 +798,9 @@ class WC_API_Customers extends WC_API_Resource {
|
|||
$customer_id = intval( $_customer['id'] );
|
||||
}
|
||||
|
||||
// Customer exists / edit customer
|
||||
if ( $customer_id ) {
|
||||
|
||||
// Customer exists / edit customer
|
||||
$edit = $this->edit_customer( $customer_id, array( 'customer' => $_customer ) );
|
||||
|
||||
if ( is_wp_error( $edit ) ) {
|
||||
|
@ -810,10 +811,9 @@ class WC_API_Customers extends WC_API_Resource {
|
|||
} else {
|
||||
$customers[] = $edit['customer'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Customer don't exists / create customer
|
||||
else {
|
||||
// Customer don't exists / create customer
|
||||
$new = $this->create_customer( array( 'customer' => $_customer ) );
|
||||
|
||||
if ( is_wp_error( $new ) ) {
|
||||
|
|
|
@ -1818,8 +1818,9 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
$order_id = intval( $_order['id'] );
|
||||
}
|
||||
|
||||
// Order exists / edit order
|
||||
if ( $order_id ) {
|
||||
|
||||
// Order exists / edit order
|
||||
$edit = $this->edit_order( $order_id, array( 'order' => $_order ) );
|
||||
|
||||
if ( is_wp_error( $edit ) ) {
|
||||
|
@ -1830,10 +1831,9 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
} else {
|
||||
$orders[] = $edit['order'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Order don't exists / create order
|
||||
else {
|
||||
// Order don't exists / create order
|
||||
$new = $this->create_order( array( 'order' => $_order ) );
|
||||
|
||||
if ( is_wp_error( $new ) ) {
|
||||
|
|
|
@ -1893,7 +1893,7 @@ class WC_API_Products extends WC_API_Resource {
|
|||
|
||||
if ( isset( $variation['stock_quantity'] ) ) {
|
||||
wc_update_product_stock( $variation_id, wc_stock_amount( $variation['stock_quantity'] ) );
|
||||
} else if ( isset( $data['inventory_delta'] ) ) {
|
||||
} else if ( isset( $data['inventory_delta'] ) ) {
|
||||
$stock_quantity = wc_stock_amount( get_post_meta( $variation_id, '_stock', true ) );
|
||||
$stock_quantity += wc_stock_amount( $data['inventory_delta'] );
|
||||
|
||||
|
@ -3243,8 +3243,9 @@ class WC_API_Products extends WC_API_Resource {
|
|||
$product_id = wc_get_product_id_by_sku( $product_sku );
|
||||
}
|
||||
|
||||
// Product exists / edit product
|
||||
if ( $product_id ) {
|
||||
|
||||
// Product exists / edit product
|
||||
$edit = $this->edit_product( $product_id, array( 'product' => $_product ) );
|
||||
|
||||
if ( is_wp_error( $edit ) ) {
|
||||
|
@ -3256,10 +3257,9 @@ class WC_API_Products extends WC_API_Resource {
|
|||
} else {
|
||||
$products[] = $edit['product'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Product don't exists / create product
|
||||
else {
|
||||
// Product don't exists / create product
|
||||
$new = $this->create_product( array( 'product' => $_product ) );
|
||||
|
||||
if ( is_wp_error( $new ) ) {
|
||||
|
|
|
@ -154,14 +154,16 @@ class WC_API_Server {
|
|||
// allow plugins to remove default authentication or add their own authentication
|
||||
$user = apply_filters( 'woocommerce_api_check_authentication', null, $this );
|
||||
|
||||
// API requests run under the context of the authenticated user
|
||||
if ( is_a( $user, 'WP_User' ) ) {
|
||||
wp_set_current_user( $user->ID );
|
||||
}
|
||||
|
||||
// WP_Errors are handled in serve_request()
|
||||
elseif ( ! is_wp_error( $user ) ) {
|
||||
// API requests run under the context of the authenticated user
|
||||
wp_set_current_user( $user->ID );
|
||||
|
||||
} elseif ( ! is_wp_error( $user ) ) {
|
||||
|
||||
// WP_Errors are handled in serve_request()
|
||||
$user = new WP_Error( 'woocommerce_api_authentication_error', __( 'Invalid authentication method', 'woocommerce' ), array( 'code' => 500 ) );
|
||||
|
||||
}
|
||||
|
||||
return $user;
|
||||
|
|
|
@ -475,8 +475,9 @@ class WC_API_Taxes extends WC_API_Resource {
|
|||
$tax_id = intval( $_tax['id'] );
|
||||
}
|
||||
|
||||
// Tax rate exists / edit tax rate
|
||||
if ( $tax_id ) {
|
||||
|
||||
// Tax rate exists / edit tax rate
|
||||
$edit = $this->edit_tax( $tax_id, array( 'tax' => $_tax ) );
|
||||
|
||||
if ( is_wp_error( $edit ) ) {
|
||||
|
@ -487,10 +488,9 @@ class WC_API_Taxes extends WC_API_Resource {
|
|||
} else {
|
||||
$taxes[] = $edit['tax'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Tax rate don't exists / create tax rate
|
||||
else {
|
||||
// Tax rate don't exists / create tax rate
|
||||
$new = $this->create_tax( array( 'tax' => $_tax ) );
|
||||
|
||||
if ( is_wp_error( $new ) ) {
|
||||
|
|
|
@ -463,18 +463,19 @@ class WC_Form_Handler {
|
|||
*/
|
||||
public static function update_cart_action() {
|
||||
|
||||
// Add Discount
|
||||
if ( ! empty( $_POST['apply_coupon'] ) && ! empty( $_POST['coupon_code'] ) ) {
|
||||
|
||||
// Add Discount
|
||||
WC()->cart->add_discount( sanitize_text_field( $_POST['coupon_code'] ) );
|
||||
}
|
||||
|
||||
// Remove Coupon Codes
|
||||
elseif ( isset( $_GET['remove_coupon'] ) ) {
|
||||
} elseif ( isset( $_GET['remove_coupon'] ) ) {
|
||||
|
||||
// Remove Coupon Codes
|
||||
WC()->cart->remove_coupon( wc_clean( $_GET['remove_coupon'] ) );
|
||||
}
|
||||
|
||||
// Remove from cart
|
||||
elseif ( ! empty( $_GET['remove_item'] ) && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-cart' ) ) {
|
||||
} elseif ( ! empty( $_GET['remove_item'] ) && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-cart' ) ) {
|
||||
|
||||
// Remove from cart
|
||||
$cart_item_key = sanitize_text_field( $_GET['remove_item'] );
|
||||
|
||||
if ( $cart_item = WC()->cart->get_cart_item( $cart_item_key ) ) {
|
||||
|
@ -498,10 +499,10 @@ class WC_Form_Handler {
|
|||
$referer = wp_get_referer() ? remove_query_arg( array( 'remove_item', 'add-to-cart', 'added-to-cart' ), add_query_arg( 'removed_item', '1', wp_get_referer() ) ) : wc_get_cart_url();
|
||||
wp_safe_redirect( $referer );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Undo Cart Item
|
||||
elseif ( ! empty( $_GET['undo_item'] ) && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-cart' ) ) {
|
||||
} elseif ( ! empty( $_GET['undo_item'] ) && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-cart' ) ) {
|
||||
|
||||
// Undo Cart Item
|
||||
$cart_item_key = sanitize_text_field( $_GET['undo_item'] );
|
||||
|
||||
WC()->cart->restore_cart_item( $cart_item_key );
|
||||
|
@ -509,6 +510,7 @@ class WC_Form_Handler {
|
|||
$referer = wp_get_referer() ? remove_query_arg( array( 'undo_item', '_wpnonce' ), wp_get_referer() ) : wc_get_cart_url();
|
||||
wp_safe_redirect( $referer );
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
// Update Cart - checks apply_coupon too because they are in the same form
|
||||
|
|
|
@ -194,9 +194,7 @@ class WC_Post_Data {
|
|||
$order_title .= ' – ' . date_i18n( 'F j, Y @ h:i A', strtotime( $data['post_date'] ) );
|
||||
}
|
||||
$data['post_title'] = $order_title;
|
||||
}
|
||||
|
||||
elseif ( 'product' === $data['post_type'] && isset( $_POST['product-type'] ) ) {
|
||||
} elseif ( 'product' === $data['post_type'] && isset( $_POST['product-type'] ) ) {
|
||||
$product_type = stripslashes( $_POST['product-type'] );
|
||||
switch ( $product_type ) {
|
||||
case 'grouped' :
|
||||
|
|
|
@ -221,14 +221,16 @@ class WC_Product_Variation extends WC_Product {
|
|||
public function variation_is_visible() {
|
||||
$visible = true;
|
||||
|
||||
// Published == enabled checkbox
|
||||
if ( get_post_status( $this->variation_id ) != 'publish' ) {
|
||||
$visible = false;
|
||||
}
|
||||
|
||||
// Price not set
|
||||
elseif ( $this->get_price() === "" ) {
|
||||
// Published == enabled checkbox
|
||||
$visible = false;
|
||||
|
||||
} elseif ( $this->get_price() === "" ) {
|
||||
|
||||
// Price not set
|
||||
$visible = false;
|
||||
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_variation_is_visible', $visible, $this->variation_id, $this->id, $this );
|
||||
|
|
|
@ -211,9 +211,7 @@ class WC_Query {
|
|||
foreach ( $this->query_vars as $key => $var ) {
|
||||
if ( isset( $_GET[ $var ] ) ) {
|
||||
$wp->query_vars[ $key ] = $_GET[ $var ];
|
||||
}
|
||||
|
||||
elseif ( isset( $wp->query_vars[ $var ] ) ) {
|
||||
} elseif ( isset( $wp->query_vars[ $var ] ) ) {
|
||||
$wp->query_vars[ $key ] = $wp->query_vars[ $var ];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,8 +69,7 @@ class WC_Email_Customer_Refunded_Order extends WC_Email {
|
|||
$this->description = __( 'Order partially refunded emails are sent to customers when their orders are partially refunded.', 'woocommerce' );
|
||||
$this->heading = $this->heading_partial;
|
||||
$this->subject = $this->subject_partial;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->id = 'customer_refunded_order';
|
||||
$this->title = __( 'Refunded order', 'woocommerce' );
|
||||
$this->description = __( 'Order refunded emails are sent to customers when their orders are marked refunded.', 'woocommerce' );
|
||||
|
|
|
@ -142,19 +142,21 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway_CC {
|
|||
return;
|
||||
}
|
||||
|
||||
// PHP Version
|
||||
if ( version_compare( phpversion(), '5.3', '<' ) ) {
|
||||
|
||||
// PHP Version
|
||||
echo '<div class="error"><p>' . sprintf( __( 'Simplify Commerce Error: Simplify commerce requires PHP 5.3 and above. You are using version %s.', 'woocommerce' ), phpversion() ) . '</p></div>';
|
||||
}
|
||||
|
||||
// Check required fields
|
||||
elseif ( ! $this->public_key || ! $this->private_key ) {
|
||||
} elseif ( ! $this->public_key || ! $this->private_key ) {
|
||||
|
||||
// Check required fields
|
||||
echo '<div class="error"><p>' . __( 'Simplify Commerce Error: Please enter your public and private keys', 'woocommerce' ) . '</p></div>';
|
||||
}
|
||||
|
||||
// Show message when using standard mode and no SSL on the checkout page
|
||||
elseif ( 'standard' == $this->mode && ! wc_checkout_is_https() ) {
|
||||
} elseif ( 'standard' == $this->mode && ! wc_checkout_is_https() ) {
|
||||
|
||||
// Show message when using standard mode and no SSL on the checkout page
|
||||
echo '<div class="error"><p>' . sprintf( __( 'Simplify Commerce is enabled, but the <a href="%s">force SSL option</a> is disabled; your checkout may not be secure! Please enable SSL and ensure your server has a valid SSL certificate - Simplify Commerce will only work in sandbox mode.', 'woocommerce' ), admin_url( 'admin.php?page=wc-settings&tab=checkout' ) ) . '</p></div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,50 +20,49 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
function wc_template_redirect() {
|
||||
global $wp_query, $wp;
|
||||
|
||||
// When default permalinks are enabled, redirect shop page to post type archive url
|
||||
if ( ! empty( $_GET['page_id'] ) && '' === get_option( 'permalink_structure' ) && $_GET['page_id'] == wc_get_page_id( 'shop' ) ) {
|
||||
|
||||
// When default permalinks are enabled, redirect shop page to post type archive url
|
||||
wp_safe_redirect( get_post_type_archive_link( 'product' ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
// When on the checkout with an empty cart, redirect to cart page
|
||||
elseif ( is_page( wc_get_page_id( 'checkout' ) ) && wc_get_page_id( 'checkout' ) !== wc_get_page_id( 'cart' ) && WC()->cart->is_empty() && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ) {
|
||||
} elseif ( is_page( wc_get_page_id( 'checkout' ) ) && wc_get_page_id( 'checkout' ) !== wc_get_page_id( 'cart' ) && WC()->cart->is_empty() && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ) {
|
||||
|
||||
// When on the checkout with an empty cart, redirect to cart page
|
||||
wc_add_notice( __( 'Checkout is not available whilst your cart is empty.', 'woocommerce' ), 'notice' );
|
||||
wp_redirect( wc_get_page_permalink( 'cart' ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Logout
|
||||
elseif ( isset( $wp->query_vars['customer-logout'] ) ) {
|
||||
} elseif ( isset( $wp->query_vars['customer-logout'] ) ) {
|
||||
|
||||
// Logout
|
||||
wp_redirect( str_replace( '&', '&', wp_logout_url( wc_get_page_permalink( 'myaccount' ) ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Redirect to the product page if we have a single product
|
||||
elseif ( is_search() && is_post_type_archive( 'product' ) && apply_filters( 'woocommerce_redirect_single_search_result', true ) && 1 === absint( $wp_query->found_posts ) ) {
|
||||
} elseif ( is_search() && is_post_type_archive( 'product' ) && apply_filters( 'woocommerce_redirect_single_search_result', true ) && 1 === absint( $wp_query->found_posts ) ) {
|
||||
|
||||
// Redirect to the product page if we have a single product
|
||||
$product = wc_get_product( $wp_query->post );
|
||||
|
||||
if ( $product && $product->is_visible() ) {
|
||||
wp_safe_redirect( get_permalink( $product->id ), 302 );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure payment gateways are loaded early
|
||||
elseif ( is_add_payment_method_page() ) {
|
||||
} elseif ( is_add_payment_method_page() ) {
|
||||
|
||||
// Ensure payment gateways are loaded early
|
||||
WC()->payment_gateways();
|
||||
|
||||
}
|
||||
} elseif ( is_checkout() ) {
|
||||
|
||||
// Checkout pages handling
|
||||
elseif ( is_checkout() ) {
|
||||
// Checkout pages handling
|
||||
// Buffer the checkout page
|
||||
ob_start();
|
||||
|
||||
// Ensure gateways and shipping methods are loaded early
|
||||
WC()->payment_gateways();
|
||||
WC()->shipping();
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'template_redirect', 'wc_template_redirect' );
|
||||
|
@ -203,23 +202,25 @@ function wc_body_class( $classes ) {
|
|||
$classes = (array) $classes;
|
||||
|
||||
if ( is_woocommerce() ) {
|
||||
|
||||
$classes[] = 'woocommerce';
|
||||
$classes[] = 'woocommerce-page';
|
||||
}
|
||||
|
||||
elseif ( is_checkout() ) {
|
||||
} elseif ( is_checkout() ) {
|
||||
|
||||
$classes[] = 'woocommerce-checkout';
|
||||
$classes[] = 'woocommerce-page';
|
||||
}
|
||||
|
||||
elseif ( is_cart() ) {
|
||||
} elseif ( is_cart() ) {
|
||||
|
||||
$classes[] = 'woocommerce-cart';
|
||||
$classes[] = 'woocommerce-page';
|
||||
}
|
||||
|
||||
elseif ( is_account_page() ) {
|
||||
} elseif ( is_account_page() ) {
|
||||
|
||||
$classes[] = 'woocommerce-account';
|
||||
$classes[] = 'woocommerce-page';
|
||||
|
||||
}
|
||||
|
||||
if ( is_store_notice_showing() ) {
|
||||
|
|
|
@ -76,12 +76,12 @@
|
|||
<!-- <exclude name="Squiz.Commenting.InlineComment.NoSpaceBefore" /> -->
|
||||
<exclude name="Squiz.Commenting.InlineComment.NotCapital" />
|
||||
<!-- <exclude name="Squiz.Commenting.InlineComment.SpacingAfter" /> -->
|
||||
<exclude name="Squiz.Commenting.InlineComment.SpacingBefore" />
|
||||
<!-- <exclude name="Squiz.Commenting.InlineComment.SpacingBefore" /> -->
|
||||
<exclude name="Squiz.Commenting.InlineComment.WrongStyle" />
|
||||
<exclude name="Squiz.Commenting.VariableComment.Missing" />
|
||||
<exclude name="Squiz.Commenting.VariableComment.MissingVar" />
|
||||
<exclude name="Squiz.Commenting.VariableComment.WrongStyle" />
|
||||
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
|
||||
<!-- <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" /> -->
|
||||
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" />
|
||||
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" />
|
||||
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterDefault" />
|
||||
|
|
|
@ -28,8 +28,7 @@ do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
|
|||
<p><?php
|
||||
if ( $partial_refund ) {
|
||||
printf( __( 'Hi there. Your order on %s has been partially refunded.', 'woocommerce' ), get_option( 'blogname' ) );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printf( __( 'Hi there. Your order on %s has been refunded.', 'woocommerce' ), get_option( 'blogname' ) );
|
||||
}
|
||||
?></p>
|
||||
|
|
Loading…
Reference in New Issue