good day, some time ago I bought a custom plugin and I am having the following error, I tried to contact the developer but it was not possible, I am not a programmer so within my little knowledge I cannot appreciate where the problem is, I would greatly appreciate it if you could help assess what should be corrected.
CRITICAL Uncaught Error: Call to a member function get_price() on null in /home/runcloud/webapps/DoggysMarket/wp-content/plugins/wayra-discount-surcharge/public/class-wayra-discount-surcharge-public.php:158
Stack trace:
#0 /wp-includes/class-wp-hook.php(307): Wayra_Discount_Surcharge_Public->wayra_wds_after_product_price()
#1 /wp-includes/plugin.php(191): WP_Hook->apply_filters()
#2 /wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(1872): apply_filters()
#3 /wp-content/plugins/yith-woocommerce-frequently-bought-together-premium/templates/yith-wfbt-form.php(172): WC_Product->get_price_html()
#4 /wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include('...')
#5 /wp-content/plugins/yith-woocommerce-frequently-bought-together-premium/includes/class.yith-wfbt-frontend.php(794): wc_get_template()
#6 /wp-includes/class-wp-hook.php(307): YITH_WFBT_Frontend->refresh_form()
#7 /wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#8 /wp-includes/plugin.php(476): WP_Hook->do_action()
#9 /wp-content/plugins/woocommerce/includes/class-wc-ajax.php(93): do_action()
#10 /wp-includes/class-wp-hook.php(307): WC_AJAX::do_wc_ajax()
#11 /wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#12 /wp-includes/plugin.php(476): WP_Hook->do_action()
#13 /wp-includes/template-loader.php(13): do_action()
#14 /wp-blog-header.php(19): require_once('...')
#15 /index.php(17): require('...')
#16 {main}
thrown en /wp-content/plugins/wayra-discount-surcharge/public/class-wayra-discount-surcharge-public.php en la línea 158
I did the check of the fragment but I can't see what the error is, in my opinion everything is fine but as I said, I'm not a programmer and I don't know if any function or fragment is wrong, line 158 of the error is this: $product_price = $product->get_price(); and the code snippet is as follows
// Show second price on Store and related products
$show_on_store = $this->config['show_on_store'] ?? false;
if ( ( ( is_product() && $wp->query_vars['product'] == $product->get_slug() )||$show_on_store ) && isset( WC()->session ) && 'no' != $show_discount_or_surcharge && 'no' != $show_discount_or_surcharge_cat ) {
$display_tax_mode = get_option( 'woocommerce_tax_display_shop' ); // incl = show tax on product price on product page
$product_price = $product->get_price();
if ( wc_tax_enabled() ) {
if ( ! wc_prices_include_tax() && 'incl' == $display_tax_mode ) {
$product_price = wc_get_price_including_tax( $product );
} elseif ( wc_prices_include_tax() && 'excl' == $display_tax_mode ) {
$product_price = wc_get_price_excluding_tax( $product );
}
}
$difference = $this->wayra_wds_get_difference( $product_price );
$fixed_price = $product_price + $difference;
$price .= '<div class="wds">';
if ( ! empty( $this->config['text_after_price'] ) ) {
$price .= '<div class="wds-text first">' . $this->config['text_after_price'] . '</div>';
}
if ( $product->is_type( 'variable' ) ) {
I appreciate if you can give me an orientation of the step to follow to solve my problem, thank you very much