Last active
March 16, 2022 05:09
-
-
Save rafsuntaskin/eddc2b73b3750a6a03db35f482b011d4 to your computer and use it in GitHub Desktop.
Woo 6.3.0 AR page fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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