Compatibility with WooCommerce 3.0+
-
For anyone using this plugin and experiencing incompatibilities with the latest versions of WooCommerce, the problem I got lies in the method
add_currency_to_wc
. If you haven’t added a custom currency it will return empty array of currencies and break WooCommerce. To fix this change line 120 of the main plugin filewoocommerce-custom-currency.php
fromreturn;
toreturn $wc_currencies;
. Here is the whole method:function add_currency_to_wc( $wc_currencies ) { // We need to get the array of custom currencies and add it here to woocommerce $custom_currencies_data = self::get_custom_currencies(); if( empty( $custom_currencies_data->labels ) ) return $wc_currencies; for( $i = 0; $i < count( $custom_currencies_data->labels ); $i++ ) { $label = empty( $custom_currencies_data->labels[ $i ] ) ? $custom_currencies_data->codes[ $i ] : $custom_currencies_data->labels[ $i ]; $wc_currencies[ $custom_currencies_data->codes[ $i ] ] = $label; } return $wc_currencies; }
- The topic ‘Compatibility with WooCommerce 3.0+’ is closed to new replies.