Skip to content

Instantly share code, notes, and snippets.

@keiraarts
Created November 1, 2018 19:20
Show Gist options
  • Save keiraarts/24d6b9342080688de0b04abbfed3143b to your computer and use it in GitHub Desktop.
Save keiraarts/24d6b9342080688de0b04abbfed3143b to your computer and use it in GitHub Desktop.
woo
// Original Way
add_action('init', function() {
$host = $_SERVER['REQUEST_URI'];
$directory = explode('/', $_SERVER['REQUEST_URI']);
define('WOOCOMMERCE_CHECKOUT', true);
$load = locate_template('woocommerce/checkout-themeA.php', true);
if ($load) {
exit(); // just exit if template was found and loaded
}
});
// Objectiv
add_action('init', function() (
$host = $_SERVER['REQUEST_URI'];
$directory = explode('/', $_SERVER['REQUEST_URI']);
if (in_array("checkout2", $directory)) {
$cfw = Objectiv\Plugins\Checkout\Main::instance();
Objectiv\Plugins\Checkout\Core\Redirect::checkout($cfw->settings_manager, $cfw->path_manager, $cfw->template_manager, $cfw->version);
}
});
// Modified main class
class Redirect {
/**
* @since 1.0.0
* @access public
*
* @param SettingsManager $settings_manager
* @param ExtendedPathManager $path_manager
* @param TemplateManager $template_manager
* @param $version
*/
public static function checkout($settings_manager, $path_manager, $template_manager, $version) {
$host = $_SERVER['REQUEST_URI'];
$directory = explode('/', $_SERVER['REQUEST_URI']);
if ( (function_exists('is_checkout') && is_checkout() && ! is_order_received_page() && ! is_checkout_pay_page()) || in_array("checkout2", $directory) ) {
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment