Skip to content

Instantly share code, notes, and snippets.

@interplaydesign
Created October 23, 2025 21:49
Show Gist options
  • Select an option

  • Save interplaydesign/28313b7283bb52aa3e7ae756fb6649f2 to your computer and use it in GitHub Desktop.

Select an option

Save interplaydesign/28313b7283bb52aa3e7ae756fb6649f2 to your computer and use it in GitHub Desktop.
/**
* Hotfix: load SkyVerge framework before Clover checkout script.
* Remove after updating Clover so it enqueues this itself.
*/
add_action('wp_enqueue_scripts', function () {
if (!function_exists('is_checkout') || !is_checkout()) return;
// Absolute path to the framework file you found:
$fw_path = WP_PLUGIN_DIR . '/woocommerce-gateway-firstdata/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-pay>
if (file_exists($fw_path)) {
// Convert absolute path to a public URL
$fw_url = content_url(str_replace(WP_CONTENT_DIR, '', $fw_path));
// Register + enqueue the framework
wp_register_script('sv-wc-fw', $fw_url, ['jquery'], null, true);
wp_enqueue_script('sv-wc-fw');
}
// Ensure Clover waits for the framework (guarantees load order)
global $wp_scripts;
if ($wp_scripts instanceof WP_Scripts) {
foreach ($wp_scripts->registered as $handle => $obj) {
if (!empty($obj->src) && strpos($obj->src, 'wc-first-data-clover-payment-form') !== false) {
if (wp_script_is('sv-wc-fw', 'registered') && !in_array('sv-wc-fw', $obj->deps, true)) {
$deps = $obj->deps;
$deps[] = 'sv-wc-fw';
wp_deregister_script($handle);
wp_register_script($handle, $obj->src, $deps, $obj->ver, $obj->args);
if (wp_script_is($handle, 'enqueued')) wp_enqueue_script($handle);
}
break;
}
}
}
}, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment