File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -96,15 +96,17 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
9696
9797 if (_shipping.methods.freeShipping != null ) {
9898 _shipping.methods.freeShipping.forEach ((freeShipping) {
99- Map <String , dynamic > tmpShippingOption = {};
100- tmpShippingOption = {
101- "id" : freeShipping.id,
102- "method_id" : "free_shipping" ,
103- "title" : freeShipping.title,
104- "cost" : freeShipping.cost,
105- "object" : freeShipping
106- };
107- _wsShippingOptions.add (tmpShippingOption);
99+ if (_isNumeric (freeShipping.cost)) {
100+ Map <String , dynamic > tmpShippingOption = {};
101+ tmpShippingOption = {
102+ "id" : freeShipping.id,
103+ "method_id" : "free_shipping" ,
104+ "title" : freeShipping.title,
105+ "cost" : freeShipping.cost,
106+ "object" : freeShipping
107+ };
108+ _wsShippingOptions.add (tmpShippingOption);
109+ }
108110 });
109111 }
110112 }
@@ -118,6 +120,13 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
118120 });
119121 }
120122
123+ bool _isNumeric (String str) {
124+ if (str == null ) {
125+ return false ;
126+ }
127+ return double .tryParse (str) != null ;
128+ }
129+
121130 Future <String > _getShippingPrice (int index) async {
122131 double total = 0 ;
123132 List <CartLineItem > cartLineItem = await Cart .getInstance.getCart ();
You can’t perform that action at this time.
0 commit comments