WPprodigy / woocommerce-product-fees

Add additional fees at checkout based on products that are in the cart.
https://wordpress.org/plugins/woocommerce-product-fees/
Other
26 stars 19 forks source link

Combination of product variations, price_decimal_separator . and fee < 1 fails #39

Closed digodt24 closed 4 years ago

digodt24 commented 6 years ago

I have product variations, price_decimal_separator , [comma] and a fee: 0,5 (set in the variation tab) [fee set in variation tab: 1,5 works fine, btw]

if ( '' !== $fee_name && '' !== $fee_amount && $fee_amount > 0 ) {
            return true;
        }

        return false;

returns false and no fee is added

My workaround:

               $fee_amount = str_replace( wc_get_price_decimal_separator(), '.', $fee_amount );

        if ( '' !== $fee_name && '' !== $fee_amount && $fee_amount > 0 ) {
            return true;
        }

        return false;
    }

This works fine, but you should have a look at this issue

digodt24 commented 6 years ago

http://sandbox.onlinephpfunctions.com/code/b7a3955e5652e5e38182613cbe4a8f9f79758638

WPprodigy commented 6 years ago

Ah, nice find. Can't compare to being greater than 0 until I turn it into a valid number. Thanks, will get this fixed up.

WPprodigy commented 4 years ago

Fixed in https://github.com/WPprodigy/woocommerce-product-fees/commit/5b1c364a27126397587b662354cd277888387ab1