Draft
Fix WooSell class resolution in PPOM\Support\Helpers#625
PPOM\Support\Helpers#625Conversation
Copilot
AI
changed the title
[WIP] Fix fatal error on product pages with WooSell Wholesale Prices plugin
Fix WooSell class resolution in May 27, 2026
PPOM\Support\Helpers
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Product pages could fatally error when WooSell Wholesale Prices is active because
Helpers.phpis namespaced (PPOM\Support) but WooSell classes were referenced without global namespace qualification. PHP attempted to resolve them asPPOM\Support\WWP_*, which does not exist.get_product_price()\:\WWP_Wholesale_Roles\WWP_Wholesale_Prices\WWP_Helper_Functionsget_product_regular_price()WWP_Wholesale_Roleswith\in wholesale role lookup.Original prompt
Bug
A fatal error occurs on product pages when the WooSell Wholesale Prices plugin is active:
Root Cause
src/Support/Helpers.phpis declared in thePPOM\Supportnamespace. The methodsget_product_price()(lines ~164–173) andget_product_regular_price()(lines ~208–213) reference three third-party classes —WWP_Wholesale_Roles,WWP_Wholesale_Prices, andWWP_Helper_Functions— without a leading backslash. PHP therefore tries to resolve them asPPOM\Support\WWP_*, which don't exist, causing a fatal error.Fix
In
src/Support/Helpers.php, prefix all three class names with\so they resolve from the global namespace:In
get_product_price()(~line 164):In
get_product_regular_price()(~line 208):Only these specific class name references need changing — no other logic should be modified.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: A user reported this error with the latest version:
Fatal error: Uncaught Error: Class "PPOM\Support|WWP_Wholesale_Roles" not found in /home/4969065886/domains/mk-tekholsters.com/public_html/wp-content/plugins/woocommerce-product-addon/src/Support/Helpers.php:166 Stack trace: #0/home/4969065886/domains/mk-tekholsters.com/public_html/wp-content/plugins/woocommerce-product-addon/src/Support/Helpers.php(1222):PPOM|Support Helpers: get_product_price() #1/home/u969065886/domains/mk-tekholsters.com/public_html/wp-content/plugins/woocommerce-product-addon/inc/functions.php(105): PPOM|Support|Helpers::convert_options_to_key_vall) #2/home/4969065886/domains/mk-tekholsters.com/public_html/wp-content/plugins/woocommerce-product-addon/classes/frontend-scripts.class.php(367):ppom_convert_options_to_key_val) #3/home/u969065886/domains/mk-tekholsters.com/public_html/wp-content/plugins/woocommerce-product-addon/classes/frontend-scripts.class.php(260):PPOM_FRONTEND_SCRIPTS::load_scripts_by_product_id() #4/home/u969065886/domains/mk-tekholsters.com/public_html/wp-includes/class-wp-hook.php(341): PPOM_FRONTEND_SCRIPTS::load_scripts() #5/home/4969065886/domains/mk-tekholsters.com/public_html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters) #6/home/u969065886/domains/mk-tekholsters.com/public_html/wp-includes/plugin.php(522): WP_Hook->do_action) #7/home/4969065886/domains/mk-tekholsters.com/public_html/wp-includes/script-loader.php(2329): do_action() #8/home/u969065886/domains/mk-tekholsters.com/public_html/wp-includes/class-wp-hook.php(341): wp_enqueue_scripts) #9/home/u969065886/domains/mk-tekholsters.com/public_html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters) #10/home/4969065886/domains/mk-tekholsters.com/public_html/wp-includes/plugin.php(522): WP_Hook->do_action() #11/home/u969065886/domains/mk-tekholsters.com/public_html/wp-includes/general-template.php(3208): do_action() #12/home/u969065886/domains/mk-tekholsters.com/public_html/wp-content/themes/astra/header.php(31): wp_head) #13 /home/4969065886/domains/mk-tekholsters.com/public_html/wp-includes/template.php(814): require_once(/home/u96906588..') #14/home/u969065886/domains/mk-tekholsters.com/public_htm|/wp-includes/template.php(749): load_template() #15 /home/4969065886/domains/mk-tekholsters.com/public_htm|/wp-includes/general-template.php(48): locate_template() #16/home/4969065886/domains/mk-tekholsters.com/public_html/wp-content/plugins/elementor/modules/page-templates/templates/header-footer.php(9): get_header) #17/home/u969065886/domains/mk-tekholsters.com/public_html/wp-includes/template-loader.php(132): include(/home/u96906588..') #18/home/u969065886/domains/mk-tekholsters.com/public_html/wp-blog-header.php(19): require_once(/home/u96906588...) #19 /home/4969065886/domains/mk-tekholsters.com/public_html/index.php(17):require('/home/u969065...
This pull request was created from Copilot chat.