PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Price rounding only works in Cart

This support system is for all types of the plugins as for premium versions, so for free ones! If you have premium version do not forget in the private data of the request (!!not in the text of the support request!!) after its publishing insert purchase code please (see blue-green button on the right side) and press Save button.
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi!

I've bought the Pro addon and tried to round the price via the example given on your website. Unfortunately, this only seems to work in the cart & checkout. I would be happy if you could assist.

Hello

I  check  it. the price on the product page and on the cart page is the same - https://share.stackovergo.com/image/i20211123122038.png and https://clip2net.com/s/4e5x9v0

Do I have to do something special to get this error?

Hi Pablo,

thanks for taking the time. I forgot to upate this thread. I intitally included the price rounding filter that is provided in the codex and plugged it into the functions.php.

add_filter('woocs_raw_woocommerce_price', function($price) { return round($price + 0.01)0.01; });

This lead to the described error. However, when I opened the products in the admin panel I received a critical error that was pointing to this filter

An error of type E_ERROR was caused in line 80 of the file ../../../wp-content/themes/shopkeeper/functions.php. Error message: Uncaught TypeError: Unsupported operand types: string * int in ../../../wp-content/themes/shopkeeper/functions.php:80

Stack trace:

#0 ../../../wp-includes/class-wp-hook.php(303): {closure}('')

#1 ../../../wp-includes/plugin.php(189): WP_Hook->apply_filters('', Array)

#2 ../../../wp-content/plugins/woocommerce-currency-switcher/classes/woocs.php(1829): apply_filters('woocs_raw_wooco...', '')

#3 ../../../wp-includes/class-wp-hook.php(303): WOOCS->raw_woocommerce_price('', Object(WC_Product_Variable))

#4 ../../../wp-includes/plugin.php(189): WP_Hook->apply_filters('', Array)

#5 ../../../wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php(797): apply_filters('woocommerce_pro...', '', Object(WC_Product_Variable))

#6 ../../../wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(279): WC_Data->get_prop('regular_price', 'view')

#7 ../../../wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-products.php(183): WC_Product->get_regular_price()

#8 ../../../wp-content/plugins/woocommerce/includes/admin/list-tables/abstract-class-wc-admin-list-table.php(261): WC_Admin_List_Table_Products->render_name_column()

#9 ../../../wp-includes/class-wp-hook.php(303): WC_Admin_List_Table->render_columns('name', 12526)

#10 ../../../wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)

#11 ../../../wp-includes/plugin.php(470): WP_Hook->do_action(Array)

#12 ../../../wp-admin/includes/class-wp-posts-list-table.php(1343): do_action('manage_product_...', 'name', 12526)

#13 ../../../wp-admin/includes/class-wp-list-table.php(1452): WP_Posts_List_Table->column_default(Object(WP_Post), 'name')

#14 ../../../wp-admin/includes/class-wp-posts-list-table.php(1377): WP_List_Table->single_row_columns(Object(WP_Post))

#15 ../../../wp-admin/includes/class-wp-posts-list-table.php(795): WP_Posts_List_Table->single_row(Object(WP_Post), 0)

#16 ../../../wp-admin/includes/class-wp-posts-list-table.php(772): WP_Posts_List_Table->_display_rows(Array, 0)

#17 ../../../wp-admin/includes/class-wp-list-table.php(1364): WP_Posts_List_Table->display_rows()

#18 ../../../wp-admin/includes/class-wp-list-table.php(1291): WP_List_Table->display_rows_or_placeholder()

#19 ../../../wp-admin/edit.php(476): WP_List_Table->display()

#20 {main}

As a result I completely removed the rounding filter - I still need that function however, so please advise :)

Try  to  use

add_filter('woocs_raw_woocommerce_price', function($price) { return round((float)$price + 0.01) - 0.01; });

Thanks. This solved the issue with the error in the products. The original error is still there: Price in shop is different that the price in the cart.

Hello

Please  read  this - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices/

Hello.

Uff, thank you. My mistake for not reading the docs right.

Thanks for the patience

Welcome;)