Skip to content

Commit f5fffde

Browse files
committed
remove unnecessary auth filter; make products array in REST response simpler
1 parent 79cb032 commit f5fffde

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

src/AbandonedCarts/CartHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ protected function save_cart_data( $user_id, $customer_data ) {
242242
$user_id,
243243
$customer_data['billing']['email'],
244244
maybe_serialize( [
245-
'products' => WC()->cart->get_cart(),
245+
'products' => array_values( WC()->cart->get_cart() ),
246246
'coupons' => WC()->cart->get_applied_coupons(),
247247
'customer' => $customer_data,
248248
'shipping_method' => WC()->checkout()->get_posted_data()['shipping_method'],

src/Rest/Registrar.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class Registrar extends Service {
3838
*/
3939
public function register_hooks() {
4040
add_action( 'rest_api_init', [ $this, 'init_rest_endpoints' ] );
41-
add_filter( 'woocommerce_rest_is_request_to_rest_api', [ $this, 'register_endpoints_with_woo_auth_handler' ] );
4241
}
4342

4443
/**
@@ -50,26 +49,5 @@ public function register_hooks() {
5049
public function init_rest_endpoints() {
5150
( new AbandonedCartsController() )->register_routes();
5251
}
53-
54-
/**
55-
* Register REST endpoints with wc/cc-woo namespace with WooCommerce's REST auth handler.
56-
*
57-
* @author George Gecewicz <[email protected]>
58-
* @since 2019-11-13
59-
*
60-
* @return bool
61-
*/
62-
public function register_endpoints_with_woo_auth_handler() {
63-
$request_uri = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
64-
65-
if ( empty( $request_uri ) ) {
66-
return false;
67-
}
68-
69-
$rest_prefix = trailingslashit( rest_get_url_prefix() );
70-
71-
return false !== strpos( $request_uri, $rest_prefix . self::$namespace );
72-
}
73-
7452
}
7553

0 commit comments

Comments
 (0)