Only apply transaction fees to buy and sells, exclude wallet to wallet transfers

I’m trying to only apply transaction fees to buy, transfer, and sells from pancake swap, exluding wallet to wallet transfers. How do I go about this?

:computer: Environment

Remix

:memo:Details

I have my transaction fees working, my tokenomics are fine. I just want to exclude any wallet to wallet transfers from fees.

You can try to add something like this inside transfer function:

if(sender == pair || recipient == pair) {
    ....
    ....
}

where pair is your token pair

I don’t have a pair yet. I haven’t deployed yet. I just want to have fees on pancakeswap when buying or selling but no fees elsewise.

man you have to replace pair with your variable name

So should I change pair to the name of the token and change the dots to takefee=false

In your code you should have a pair named like uniswapV2pair. SOmething similar to this