• Resolved Francisco

    (@fmarconi)


    Hi! I need to apply different decimal numbers to USD and CLP. But can’t find the option neither filter hook. I see there is a currency_exchange.js but no hook.
    Regards,
    Francisco

    Edit:
    I did it this way:

    add_filter( 'wc_get_price_thousand_separator', 'custom_price_separator' );
    function custom_price_separator($separator)
    {
    	$BeRocket_CE = BeRocket_CE::getInstance();
    	return $BeRocket_CE::woocommerce_currency(null)=='USD'?$separator:'.';
    }
    add_filter( 'wc_get_price_decimals', 'custom_price_decimals', 9999, 1 );
    function custom_price_decimals( $decimals )
    {
    	$BeRocket_CE = BeRocket_CE::getInstance();
    	return $BeRocket_CE::woocommerce_currency(null)=='USD'?$decimals:0;
    }
    • This topic was modified 3 years, 3 months ago by Francisco.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter Francisco

    (@fmarconi)

    A better approach:

    add_filter( 'wc_get_price_thousand_separator', 'custom_price_separator', 0 );
    function custom_price_separator($separator)
    {
    	$BeRocket_CE = BeRocket_CE::getInstance();
    	return $BeRocket_CE::$currency!='CLP'?$separator:'.';
    }
    add_filter( 'wc_get_price_decimals', 'custom_price_decimals', 0 );
    function custom_price_decimals($decimals)
    {
    	$BeRocket_CE = BeRocket_CE::getInstance();
    	return $BeRocket_CE::$currency!='CLP'?$decimals:0;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘change decimal number in “visual only”’ is closed to new replies.