Adding fees on a BEP20 contract, help :/

Hello guys,
I'm a junior developer going into web3 and i'm experiencing some test with the BSC and pancakeswap.
I've already created some tokens for test with the openzeppelin contract, and it works fine.
However, i'm trying now to add fees only on BUYS and SELLS, I did read some topic for a solution but it doesnt work for me.

The contract is well deployed, but when I try to add some liquidity on the BSC test net -> with this router adress -> 0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3
When I want to supply the token I got this error ->
"Fail with error 'TransferHelper::transferFrom: transferFrom failed'"

I have multiple questions, when I create this function, is it overriding the native _transfer function from OZ ?
The internal override parameters of the function are right ?
I struggle to fix the bug, if a kind soul is around, I would appreciate some help.
Thank you in advance.

:1234: Code to reproduce

pragma solidity 0.8.7;

import "";
import "";

contract Test is ERC20 {

    using SafeMath for uint256;
    address private marketing_wallet = "the marketing wallet address;
    address ROUTER = "the router adress";
    mapping(address => uint256) private _balances;

    constructor(uint256 initialSupply) ERC20 ("Test", "TST"){
        _mint(msg.sender, initialSupply);

    function _transfer(address from, address to, uint256 amount) internal override {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        if(msg.sender == ROUTER || to == ROUTER) {
            uint256 fee = 2 * 10;
            uint256 feeAmount = amount /  100 * fee;
            amount -= feeAmount;
            _balances[marketing_wallet] += feeAmount;

            _balances[to] += amount;
        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);

:computer: Environment

Remix IDE online

Hey @Ozzipozzo
I gave a fast check and I saw that you divide and then multiply.

Remember, in solidity if you do A / B, where B > A ---> you will get 0

Recomended Read:

Another thing
replace ROUTER with the pair if your aim is to tax buy and sell. SO instead of declaring a router variable you will need to declare the pair address

if(from == pair || to == pair)