PluginUs.Net - Công cụ kinh doanh cho WooCommerce và WordPress

[hiện thực hóa ý tưởng của bạn - biến ước mơ của bạn thành hiện thực]

Hỗ trợ Forum

Bạn cần đăng nhập để tạo yêu cầu (chủ đề) cho bộ phận hỗ trợ

Làm tròn giá chỉ hoạt động trong Giỏ hàng

Bộ phận hỗ trợ không làm việc vào Thứ Bảy và Chủ Nhật, vì vậy một số yêu cầu vào Thứ Sáu có thể được trả lời vào Thứ Hai. Nếu bạn gặp vấn đề với việc đăng ký, hãy yêu cầu trợ giúp về Liên hệ với chúng tôi làm ơn trang
Nếu bạn không nhận được email trong vòng 24 ~ 36 giờ làm việc, trước tiên hãy kiểm tra hộp thư rác của bạn và nếu không có email nào từ bộ phận hỗ trợ ở đó - hãy quay lại diễn đàn và đọc câu trả lời tại đây. KHÔNG TRẢ LỜI VỀ EMAIL [noreply@pluginus.net] TỪ DIỄN ĐÀN !! Email chỉ là thông tin của bạn, tất cả các câu trả lời chỉ nên được xuất bản ở đây.
Bộ phận hỗ trợ không hoạt động vào Thứ Bảy và Chủ Nhật, vì vậy, một số yêu cầu vào Thứ Sáu có thể được trả lời vào Thứ Hai.

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.

Xin chào

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

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

Xin chào 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', chức năng(giá $) { trở lại tròn(giá $ + 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

Theo dõi ngăn xếp:

#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 {chính}

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

Thử sử dụng

add_filter('woocs_raw_woocommerce_price', chức năng(giá $) { trở lại tròn((float)giá $ + 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.

Xin chào

Hãy đọc cái này - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices/

Chào bạn.

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

Thanks for the patience

Chào mừng;)