First, enable real-time carrier calculated rates on Shopify’s end. If you’re the “Advanced” plan user, the live rates feature is included in your plan. You’re able to request this feature if you’re using the “Shopify” plan by contacting Shopify and requesting they add live rates for $20/month.
Second, connect your Shopify live rates feature to Printful. Go to your Printful Dashboard > Settings > Shipping and choose your Shopify store. Under the Enable live shipping rates for Printful products with Shopify heading, click the checkbox next to Use live rates for my Printful products. And you've connected your Shopify's live rates to Printful!
If your store has products you store at Printful's warehouses or products you fulfill elsewhere, you have to add shipping costs for those products separately on Shopify's end.
In cases where your customer has both Printful and non-Printful products in their cart, Shopify will automatically take the lowest available shipping rate from both product groups and combine them together into one. So your customer will see one shipping option available at the checkout.
If you wish to create more advanced shipping rate combinations, there are some paid apps like Advanced Shipping Rules that will allow you to do that.