Skip to content

Instantly share code, notes, and snippets.

@rafsuntaskin
Last active March 16, 2022 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafsuntaskin/eddc2b73b3750a6a03db35f482b011d4 to your computer and use it in GitHub Desktop.
Save rafsuntaskin/eddc2b73b3750a6a03db35f482b011d4 to your computer and use it in GitHub Desktop.
Woo 6.3.0 AR page fix
<?php
add_filter( 'woocommerce_is_rest_api_request', 'simulate_as_not_rest' );
/**
* Mock REST request as frontend to load cart session.
*
* Since WooCommerce 6.3.0
*
* @param bool $is_rest_api_request
* @return bool
*/
function simulate_as_not_rest( $is_rest_api_request ) {
if ( ! $is_rest_api_request ) {
return $is_rest_api_request;
}
// Bail early if this is not our request.
if ( false === strpos( $_SERVER['REQUEST_URI'], '/cart' ) ) {
return $is_rest_api_request;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment