• Resolved Chad Cloman

    (@chadcloman)


    I receive the following PHP warning from this plugin:

    [01-Sep-2022 21:44:53 UTC] PHP Warning:  Undefined variable $product in <path-to-wordpress>/wp-content/plugins/change-quantity-on-checkout-for-woocommerce/change-quantity-on-checkout-woocommerce.php on line 56
    
    

    Viewing the code, the warning comes from these lines:

    'max_value'   => apply_filters( 'woocommerce_quantity_input_max', $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(), $product ),
    'min_value'   => apply_filters( 'woocommerce_quantity_input_min', 1, $product ),
    
    

    The error appears to be the use of $product (which is not defined) instead of $_product (which is defined).

    Hope this helps.

    • This topic was modified 2 years, 2 months ago by Chad Cloman. Reason: scroll bar overwrites code section unless there's an extra blank line at the end
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author bhavik.kiri

    (@bhavikkiri)

    Hi @chadcloman

    I apologize for the delay in response.

    I have updated the plugin and released the fix in version 2.1, can you please update and confirm whether the warning is fixed or not

    Regards,
    Bhavik

    Thread Starter Chad Cloman

    (@chadcloman)

    I let it run a couple weeks and it looks good. None of those messages in the error log.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Warning’ is closed to new replies.