Skip to content

Instantly share code, notes, and snippets.

@benfavre
Last active April 11, 2020 09:30
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 benfavre/d908250724ccea5c8da7fda7cfe946aa to your computer and use it in GitHub Desktop.
Save benfavre/d908250724ccea5c8da7fda7cfe946aa to your computer and use it in GitHub Desktop.
Optimize WordPress WooCommerce - Oxygen

NON standard dirty SET of custom modifications to optimize baseline load times on WordPress sites with WooCommerce

  1. Disable weird cart sessions init on API calls ( maybe_init_cart_session )
<?php
// woocommerce/packages/woocommerce-blocks/src/RestApi.php
/**
* Initialize class features.
*/
public static function init() {
add_action( 'rest_api_init', array( __CLASS__, 'register_rest_routes' ), 10 );
// START OF MODIFICATION
// add_filter( 'rest_authentication_errors', array( __CLASS__, 'maybe_init_cart_session' ), 1 ); // This may break stuff for you
// END OF MODIFICATION
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment