How can I remove decimals when I award user points via commerce-order-total:amount I want award users after completing the checkout process. For this task I use this modules (Commerce, UserPoints, Commerce Credits).

I create a product with a price equal 15$ and create a rule which award user after complete checkout. When checkout is complete, rule works great, but it gives user 1500 userpoints instead 15. I tried use module (Commerce Price Decimals Formatter, Commerce Extra Price Formatters) which remove decimals from commerce also I tried use some code from internet but all of it doesn't solve my issue.

Does anybody know solution for this issue?

it's code that I found on the internet:

&lt;?php
/**
 * Implements hook_commerce_currency_info_alter().
 */
function Zero_commerce_currency_info_alter(&amp;$currencies, $langcode) {
  $currencies['USD']['format_callback'] = 'Zero_rub_currency_format';
}

 /**
 * Currency format callback.
 */
function Zero_rub_currency_format($amount, $currency, $object) {
  $round_amount = commerce_currency_round(abs($amount), $currency);
  $price = number_format($round_amount, 0, $currency['decimal_separator'], $currency['thousands_separator']);

  $replacements = array(
    '@code_before' =&gt; $currency['code_placement'] == 'before' ? $currency['code'] : '',
    '@symbol_before' =&gt; $currency['symbol_placement'] == 'before' ? $currency['symbol'] : '',
    '@price' =&gt; $price,
    '@symbol_after' =&gt; $currency['symbol_placement'] == 'after' ? $currency['symbol'] : '',
    '@code_after' =&gt; $currency['code_placement'] == 'after' ? $currency['code'] : '',
    '@negative' =&gt; $amount &lt; 0 ? '-' : '',
    '@symbol_spacer' =&gt; $currency['symbol_spacer'],
    '@code_spacer' =&gt; $currency['code_spacer'],
  );

  return trim(t('@code_before@code_spacer@negative@symbol_before@price@symbol_spacer@symbol_after@code_spacer@code_after', $replacements));
}


It is my Rule:

{ "rules_grantpointaftercheckout" : {
"LABEL" : "GrantPointAfterCheckOut",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "userpoints_rules", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"DO" : [
  { "data_convert" : {
      "USING" : {
        "type" : "integer",
        "value" : [ "commerce-order:commerce-order-total:amount" ],
        "rounding_behavior" : "down"
      },
      "PROVIDE" : { "conversion_result" : { "conversion_result" : "Conversion result" } }
    }
  },
  { "userpoints_action_grant_points" : {
      "user" : [ "site:current-user" ],
      "points" : [ "conversion-result" ],
      "tid" : "0",
      "entity" : [ "site:current-cart-order" ],
      "operation" : "bla bla bla",
      "display" : "1",
      "moderate" : "approved"
    }
  }
]
}
}
Have a look at the Drupal Commerce issue about "Revise the way we handle price amount values". Especially comment nr 37 in it, which states:


  The price field is and will continue to store price amounts as integers ...


So rounding an amount of 1500 dollarcents is ... still 1500, right? And that is the amount of user points you're granting. And because of that, your rule works as implemented: you're using that value of 1500 as the amount of userpoints to be granted.

Obviously, all you need to do next is to expand your rule to devide the price by 100 first (before rounding it). I assume you know how to do that, if not use this link ... bonus hint: have a look at the example rule included in the answer to "How to add up all items of a field collection field using Rules?", especially the "Calculate a value" Rules Action.