• wijnbergdevelopments

    (@wijnbergdevelopments)


    Hello,

    I’m the developer of https://www.ads-software.com/plugins/tax-switch-for-woocommerce/. One of our users reported a conflict between our plugins that I’ve investigated.

    The issue happens when the Tax Switch plugin creates a temporary WooCommerce product object for price calculations:

    $calculator = new WC_Product_Simple();

    This eventually triggers your <code class=”bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.3rem] px-1 py-px text-[0.9rem]”>elex_rp_get_adjustment_for_individual_products() method in <code class=”bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.3rem] px-1 py-px text-[0.9rem]”>Elex_Price_Discount_Admin. The problem occurs on line 791 where:

    $product = wc_get_product($pid);
    $product_price_adjustment_users = $product->get_meta('product_price_adjustment_for_users');

    For temporary product objects, wc_get_product($pid) returns false, causing a PHP error when trying to call get_meta() on a non-object. Could you add this check before accessing the product’s meta data?

    if (!$product || !is_object($product)) { return 'no_amount'; }

    This would fix the compatibility issue between our plugins.

    Thank you in advance!

  • You must be logged in to reply to this topic.