|
|
@@ -34,9 +34,15 @@ class Studiou_WC_FPP_Single_Product {
|
|
|
|
|
|
/**
|
|
|
* Detach pvtfw's variant-table + available-options-button hooks on FPP products.
|
|
|
- * pvtfw exposes its instances as globals $pvtfw_print_table and $pvtfw_available_btn;
|
|
|
- * the table hook/priority is derived from the same option pvtfw itself reads
|
|
|
- * (pvtfw_variant_table_place, default woocommerce_after_single_product_summary_9).
|
|
|
+ *
|
|
|
+ * pvtfw assigns its singletons to `$pvtfw_print_table` / `$pvtfw_available_btn` at the
|
|
|
+ * top of its class files, but the `require_once` call lives inside pvtfw's
|
|
|
+ * PVTFW_TABLE::includes() method — so those assignments end up as method-locals, NOT
|
|
|
+ * true globals. We therefore reach the singletons via their static ::instance()
|
|
|
+ * (the same object pvtfw registered the actions with). The variant-table hook and
|
|
|
+ * priority are derived from pvtfw's own pvtfw_variant_table_place option (default
|
|
|
+ * woocommerce_after_single_product_summary_9) so admin-configured placements
|
|
|
+ * remain supported.
|
|
|
*/
|
|
|
public function maybe_suppress_pvtfw() {
|
|
|
if (!function_exists('is_product') || !is_product()) {
|
|
|
@@ -47,24 +53,25 @@ class Studiou_WC_FPP_Single_Product {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- global $pvtfw_print_table, $pvtfw_available_btn;
|
|
|
-
|
|
|
- if ($pvtfw_print_table) {
|
|
|
+ if (class_exists('PVTFW_PRINT_TABLE')) {
|
|
|
+ $print_table = PVTFW_PRINT_TABLE::instance();
|
|
|
$place = get_option('pvtfw_variant_table_place', 'woocommerce_after_single_product_summary_9');
|
|
|
$tail = strrchr((string) $place, '_');
|
|
|
if ($tail !== false && strlen($tail) > 1) {
|
|
|
$priority = (int) ltrim($tail, '_');
|
|
|
$hook = substr($place, 0, -strlen($tail));
|
|
|
if ($hook) {
|
|
|
- remove_action($hook, array($pvtfw_print_table, 'print_table'), $priority);
|
|
|
+ remove_action($hook, array($print_table, 'print_table'), $priority);
|
|
|
}
|
|
|
}
|
|
|
} elseif (defined('WP_DEBUG') && WP_DEBUG) {
|
|
|
- error_log('STUDIOU FPP: $pvtfw_print_table not found; cannot detach pvtfw variant table.');
|
|
|
+ error_log('STUDIOU FPP: PVTFW_PRINT_TABLE class not found; cannot detach pvtfw variant table.');
|
|
|
}
|
|
|
|
|
|
- if ($pvtfw_available_btn) {
|
|
|
- remove_action('woocommerce_single_product_summary', array($pvtfw_available_btn, 'available_options_btn'), 11);
|
|
|
+ // Note: pvtfw's class name has a typo ("AVAILABE" missing the L) — match it verbatim
|
|
|
+ if (class_exists('PVTFW_AVAILABE_BTN')) {
|
|
|
+ $available_btn = PVTFW_AVAILABE_BTN::instance();
|
|
|
+ remove_action('woocommerce_single_product_summary', array($available_btn, 'available_options_btn'), 11);
|
|
|
}
|
|
|
}
|
|
|
|