• Resolved wooq123

    (@wooq123)


    I have a custom line of php in my functions.php file that adds a message directly below the item price of items that belong to a specific category. When I go beyond version 3.3.4 of this plugin, that code stops working, and in place of it I get the following error. Please let me know if there is a way to resolve this- as of right now I cannot update beyond 3.3.4.

    Warning: A non-numeric value encountered in /home/main-directory/public_html/my-website/wp-content/plugins/aco-woo-dynamic-pricing/includes/class-awdp-discount.php on line 269

    • This topic was modified 6 years, 4 months ago by wooq123.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support ijas

    (@ijasacodez)

    Sorry for the late response, can you please replace the plugin file with the one on shared link. We will be releasing an update with the fix and some additional options asap.

    Link: https://drive.google.com/file/d/1SintJBDpdZtdeXOcrwbcjL4uKQE37C1g/view?usp=sharing

    Plugin Support ijas

    (@ijasacodez)

    We have released an update with the fix, please update your plugin to the latest version.

    Thread Starter wooq123

    (@wooq123)

    Hi, thanks for these updates. The update got rid of the error, but it also caused my custom php code to stop functioning – i have basic php code in my child theme’s functions.php file that displays a custom message below the product price for product’s of a specific category. I’ve pasted the code below. Any idea why this plugin would cause this code to stop functioning all together? When I update this plugin, my custom text below the product price disappears for all of these products (previous to your newest update, the php error would display).

    /* ————————————————–
    Custom Price Message – Products of Specific Category
    * ———————————————– */
    function themeprefix_custom_price_message( $price ) {

    if ( has_term( ‘led-lights’, ‘product_cat’ ) ) {
    $textafter = ‘( Make an Offer )’; //add your text
    return $price . ‘<br /><span class=”price-description”>’ . $textafter . ‘</span>’;
    }
    else {
    return $price;
    }
    }
    add_filter( ‘woocommerce_get_price_html’, ‘themeprefix_custom_price_message’ );

    Plugin Support ijas

    (@ijasacodez)

    We have checked the code, seems working fine:

    function themeprefix_custom_price_message( $price ) {
        if ( has_term( 'led-lights', 'product_cat' ) ) {
            $textafter = '( Make an Offer )'; //add your text
            return $price . '<br /><span class="price-description">' . $textafter . '</span>';
        } else {
            return $price;
        }
    }
    add_filter( 'woocommerce_get_price_html', 'themeprefix_custom_price_message', 1001, 2 );

    Screenshot: https://imgur.com/iKhdSdo

    Thread Starter wooq123

    (@wooq123)

    Awesome. Looks like adding that “1001, 2” at the end fixed the conflict. Thank you so much, you guys have some of the best support of any plugin.

    Plugin Support ijas

    (@ijasacodez)

    Thanks.

    Thread Starter wooq123

    (@wooq123)

    Looks like I spoke to soon – it seems to have fixed the issue for the products that I had trouble with, but on random other products, it shows that same PHP error many more times, and this time it’s showing up under the product image, the product title, and below the add to cart button (the error shows 4 times under each of those). May I need to tweak that previous code that partially worked?

    Plugin Support ijas

    (@ijasacodez)

    Can you please share a screenshot of the error screen.

    Thread Starter wooq123

    (@wooq123)

    It’s the exact same error as in my original post (Warning: A non-numeric value encountered in /home/main-directory/public_html/my-website/wp-content/plugins/aco-woo-dynamic-pricing/includes/class-awdp-discount.php on line 269) except for on certain products it shows up several times under the product image, title, and add to cart button. I’m still stuck with version 3.3.4 until I figure out why the later versions are causing this interference.

    Thread Starter wooq123

    (@wooq123)

    It appears I resolved this with 3.4.1 by adding 1001, 2 ); to the end of my php code. However, I’ve noticed a display glitch with 3.4.1 involving product prices in search view ; please see my new post.

    Plugin Support ijas

    (@ijasacodez)

    Sorry for the inconvenience, we will be releasing an update with the fix asap.

    Plugin Support ijas

    (@ijasacodez)

    We have released an update with the fix (warning), please update your plugin to the latest version.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Versions past 3.3.4 Causing PHP Error’ is closed to new replies.