Created
April 17, 2019 12:38
-
-
Save tom-it/24fae93640b86f9df0240bf4d7b2eed4 to your computer and use it in GitHub Desktop.
remove shipping option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts('loop over all line_items, and check if one has weight over 50 lbs') | |
overWeight = false | |
Input.cart.line_items.each do |line_item| | |
if line_item.grams > 22679 | |
overWeight = true | |
end | |
end | |
if overWeight | |
Output.shipping_rates = Input.shipping_rates.delete_if do |shipping_rate| | |
(shipping_rate.name == 'Your Shipping rate name to remove') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment