• It’s been a year since this has been reported and still has not been fixed, so let me do this by myself. The Courier Shipping method will not be displayed in cart/checkout after switching to PHP 8+

    Location:
    /wc-venipak-shipping/admin/class-woocommerce-shopup-venipak-shipping-admin-courier.php
    Line 160 and 161.

    When minimum weight or maximum weight is not set under the shipping method, then the get_option will return an empty string.

    After that, the condition that starts from line 164 and ends at 166, all three conditions will return false, since you’re trying to compare a string to an integrer, that as of PHP 8 will return false. Hence the rate will not be set to the shipping method and that’s the reason it is not displayed.

    Quote from PHP 8 backward incompatible changes:
    Non-strict comparisons between numbers and non-numeric strings now work by casting the number to string and comparing the strings. Comparisons between numbers and numeric strings continue to work as before. Notably, this means that 0 == "not-a-number" is considered false now.

    THE SOLUTION
    Surround minimum_weight and maximum_weight variable values with floatval function or just type cast to float.

    • This topic was modified 1 year, 2 months ago by kriztjan.
    • This topic was modified 1 year, 2 months ago by kriztjan.
    • This topic was modified 1 year, 2 months ago by kriztjan.
  • The topic ‘Courier shipping method incompatible with PHP 8+’ is closed to new replies.