mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-30 11:42:22 +08:00
https://stackoverflow.com/questions/73248585/add-3-decimal-places-to-everywhere-except-minicart-cart-and-checkout-woocommerc
10 lines
287 B
Text
10 lines
287 B
Text
add_filter(
|
|
hook_name: 'woocommerce_cart_item_price',
|
|
accepted_args: 3,
|
|
callback: function (string $price, array $item, string $key): string {
|
|
return wc_price(
|
|
price: $item['data']->get_price(),
|
|
args: [ 'decimals' => 2 ],
|
|
);
|
|
},
|
|
);
|