There are a few things you can do to avoid transaction fees on Shopify.
First, you can use Shopify Payments, which is Shopify's own payment processing system. When you use Shopify Payments, you don't pay any transaction fees - only credit card fees.
Second, you can use a third-party payment processor that doesn't charge transaction fees. There are a few options available, such as Stripe, Braintree, and Authorize.net.
Third, you can use Shopify's built-in manual payment option. With this option, you can enter your customers' credit card information manually and process the payment yourself. You'll still have to pay the credit card fees, but you won't have to pay any transaction fees.
Fourth, if you're using a payment gateway that charges transaction fees, you can add a surcharge to your customers' orders to cover the fees. This is a common practice, and it's perfectly legal as long as you disclose the surcharge to your customers before they complete their purchase.
Finally, keep in mind that some Shopify plans come with transaction fees waived. So if you're looking to save on transaction fees, you may want to consider upgrading your Shopify plan.