Filters
The plugin uses two filters for display, none of which are defined in the plugin, but if they are available, the plugin will use them. Sample codes should be placed in the (child) theme used in functions.php
.
Change weight
Weight data is basically determined by WooCommerce settings, but with this filter you can override it. The following example changes WooCommerce’s „kg” unit to „g” if it is less than 1kg.
function my_simple_price_list_filter_weigth($weight, $unit) { // Sets the value of the weight_html field in the template if (empty($weight)) { return ''; } if ($weight < 1) { $weight = $weight * 1000; $unit = 'g'; } return $weight . $unit; } add_filter( 'simple_price_list_filter_weigth', 'my_simple_price_list_filter_weigth', 10, 1 );
Change price
WooCommerce provides a formatted display of the price, but this may need to be changed.
function my_simple_price_list_filter_price($price) { // Sets the value of the price_html field in the template $regex = "/\<bdi>(\s*.*?)\<\/bdi>/i"; preg_match( $regex, $price, $match); if (!empty($match)) { if (isset($match[1])) { $price = strip_tags($match[1]); } } return $price; } add_filter( 'simple_price_list_filter_price', 'my_simple_price_list_filter_price', 10, 1 );