spyrosel Posted April 2, 2019 Share Posted April 2, 2019 Hello! I am building a custom carrier module where I am using an external service to get the shipping cost. I want to hide this carrier if the user has added more than x items in her/his cart. Is it possible? I can't find any method where I can dynamically hide the carrier based on user's cart. Thank you! Link to comment Share on other sites More sharing options...
Rodrigo B Laurindo Posted April 2, 2019 Share Posted April 2, 2019 Hello, @spyrosel, You just need to return false in getOrderShippingCost. public function getOrderShippingCost($params, $shipping_cost) { $max_item_count = 2; if (count($params->getProducts()) > $max_item_count) { return false; } /** your code here **/ } 2 Link to comment Share on other sites More sharing options...
spyrosel Posted April 3, 2019 Author Share Posted April 3, 2019 Great! Thank you very much @Rodrigo B Laurindo! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now