Skip to content

Commit 4e605bb

Browse files
committed
v2.4.0 Option to disable shipping in config
1 parent b2df6c5 commit 4e605bb

File tree

6 files changed

+107
-86
lines changed

6 files changed

+107
-86
lines changed

LabelStoreMax/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [2.4.0] - 2020-11-19
2+
3+
* Option to disable shipping in config
4+
15
## [2.3.0] - 2020-11-18
26

37
* Option to set if prices include tax

LabelStoreMax/lib/helpers/data/order_wc.dart

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
7373
orderWC.billing = billing;
7474

7575
Shipping shipping = Shipping();
76+
7677
shipping.firstName = billingDetails.shippingAddress.firstName;
7778
shipping.lastName = billingDetails.shippingAddress.lastName;
7879
shipping.address1 = billingDetails.shippingAddress.addressLine;
@@ -86,14 +87,16 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
8687
orderWC.shipping = shipping;
8788

8889
orderWC.shippingLines = [];
89-
Map<String, dynamic> shippingLineFeeObj =
90-
CheckoutSession.getInstance.shippingType.toShippingLineFee();
91-
if (shippingLineFeeObj != null) {
92-
ShippingLines shippingLine = ShippingLines();
93-
shippingLine.methodId = shippingLineFeeObj['method_id'];
94-
shippingLine.methodTitle = shippingLineFeeObj['method_title'];
95-
shippingLine.total = shippingLineFeeObj['total'];
96-
orderWC.shippingLines.add(shippingLine);
90+
if (app_disable_shipping == false) {
91+
Map<String, dynamic> shippingLineFeeObj =
92+
CheckoutSession.getInstance.shippingType.toShippingLineFee();
93+
if (shippingLineFeeObj != null) {
94+
ShippingLines shippingLine = ShippingLines();
95+
shippingLine.methodId = shippingLineFeeObj['method_id'];
96+
shippingLine.methodTitle = shippingLineFeeObj['method_title'];
97+
shippingLine.total = shippingLineFeeObj['total'];
98+
orderWC.shippingLines.add(shippingLine);
99+
}
97100
}
98101

99102
if (taxRate != null) {

LabelStoreMax/lib/labelconfig.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import 'dart:ui';
1616
Developer Notes
1717
1818
SUPPORT EMAIL - [email protected]
19-
VERSION - 2.3.0
19+
VERSION - 2.4.0
2020
https://woosignal.com
2121
*/
2222

@@ -41,6 +41,8 @@ const app_currency_iso = "gbp";
4141

4242
const app_products_prices_include_tax = true;
4343

44+
const app_disable_shipping = false;
45+
4446
const Locale app_locale = Locale('en');
4547

4648
const List<Locale> app_locales_supported = [

LabelStoreMax/lib/pages/checkout_confirmation.dart

Lines changed: 87 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:flutter/material.dart';
1212
import 'package:label_storemax/app_payment_methods.dart';
1313
import 'package:label_storemax/app_state_options.dart';
1414
import 'package:label_storemax/helpers/tools.dart';
15+
import 'package:label_storemax/labelconfig.dart';
1516
import 'package:label_storemax/models/cart.dart';
1617
import 'package:label_storemax/models/checkout_session.dart';
1718
import 'package:label_storemax/models/customer_address.dart';
@@ -208,73 +209,78 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
208209
),
209210
margin: EdgeInsets.only(top: 5, bottom: 5),
210211
child: Column(
211-
crossAxisAlignment: CrossAxisAlignment.center,
212-
mainAxisAlignment: MainAxisAlignment.spaceAround,
213-
children: <Widget>[
214-
((CheckoutSession.getInstance.billingDetails != null &&
215-
CheckoutSession.getInstance.billingDetails
216-
.billingAddress !=
217-
null)
218-
? wsCheckoutRow(context,
219-
heading: trans(
220-
context, "Billing/shipping details"),
221-
leadImage: Icon(Icons.home),
222-
leadTitle: (CheckoutSession
223-
.getInstance.billingDetails ==
224-
null ||
225-
CheckoutSession.getInstance
226-
.billingDetails.billingAddress
227-
.hasMissingFields()
228-
? trans(
229-
context, "Billing address is incomplete")
230-
: CheckoutSession.getInstance
231-
.billingDetails.billingAddress
232-
.addressFull()),
233-
action: _actionCheckoutDetails,
234-
showBorderBottom: true)
235-
: wsCheckoutRow(context,
236-
heading: trans(context, "Billing/shipping details"),
237-
leadImage: Icon(Icons.home),
238-
leadTitle: trans(context, "Add billing & shipping details"),
239-
action: _actionCheckoutDetails,
240-
showBorderBottom: true)),
241-
(CheckoutSession.getInstance.paymentType != null
242-
? wsCheckoutRow(context,
243-
heading: trans(context, "Payment method"),
244-
leadImage: Image(
212+
crossAxisAlignment: CrossAxisAlignment.center,
213+
mainAxisAlignment: MainAxisAlignment.spaceAround,
214+
children: <Widget>[
215+
((CheckoutSession.getInstance.billingDetails != null &&
216+
CheckoutSession.getInstance.billingDetails
217+
.billingAddress !=
218+
null)
219+
? wsCheckoutRow(context,
220+
heading: trans(
221+
context, "Billing/shipping details"),
222+
leadImage: Icon(Icons.home),
223+
leadTitle:
224+
(CheckoutSession.getInstance.billingDetails == null ||
225+
CheckoutSession.getInstance
226+
.billingDetails.billingAddress
227+
.hasMissingFields()
228+
? trans(
229+
context, "Billing address is incomplete")
230+
: CheckoutSession.getInstance
231+
.billingDetails.billingAddress
232+
.addressFull()),
233+
action: _actionCheckoutDetails,
234+
showBorderBottom: true)
235+
: wsCheckoutRow(context,
236+
heading:
237+
trans(context, "Billing/shipping details"),
238+
leadImage: Icon(Icons.home),
239+
leadTitle: trans(context, "Add billing & shipping details"),
240+
action: _actionCheckoutDetails,
241+
showBorderBottom: true)),
242+
(CheckoutSession.getInstance.paymentType != null
243+
? wsCheckoutRow(context,
244+
heading: trans(context, "Payment method"),
245+
leadImage: Image(
245246
image: AssetImage("assets/images/" +
246247
CheckoutSession.getInstance
247248
.paymentType.assetImage),
248-
width: 70),
249-
leadTitle: CheckoutSession
250-
.getInstance.paymentType.desc,
251-
action: _actionPayWith,
252-
showBorderBottom: true)
253-
: wsCheckoutRow(context,
254-
heading: trans(context, "Pay with"),
255-
leadImage: Icon(Icons.payment),
256-
leadTitle:
257-
trans(context, "Select a payment method"),
258-
action: _actionPayWith,
259-
showBorderBottom: true)),
260-
(CheckoutSession.getInstance.shippingType != null
261-
? wsCheckoutRow(context,
262-
heading: trans(context, "Shipping selected"),
263-
leadImage: Icon(Icons.local_shipping),
264-
leadTitle: CheckoutSession
265-
.getInstance.shippingType
266-
.getTitle(),
267-
action: _actionSelectShipping)
268-
: wsCheckoutRow(
269-
context,
270-
heading: trans(context, "Select shipping"),
271-
leadImage: Icon(Icons.local_shipping),
272-
leadTitle: trans(
273-
context, "Select a shipping option"),
274-
action: _actionSelectShipping,
275-
)),
276-
],
277-
),
249+
width: 70,
250+
),
251+
leadTitle: CheckoutSession
252+
.getInstance.paymentType.desc,
253+
action: _actionPayWith,
254+
showBorderBottom: true)
255+
: wsCheckoutRow(context,
256+
heading: trans(context, "Pay with"),
257+
leadImage: Icon(Icons.payment),
258+
leadTitle: trans(
259+
context, "Select a payment method"),
260+
action: _actionPayWith,
261+
showBorderBottom: true)),
262+
app_disable_shipping == true
263+
? null
264+
: (CheckoutSession.getInstance.shippingType !=
265+
null
266+
? wsCheckoutRow(context,
267+
heading:
268+
trans(context, "Shipping selected"),
269+
leadImage: Icon(Icons.local_shipping),
270+
leadTitle: CheckoutSession
271+
.getInstance.shippingType
272+
.getTitle(),
273+
action: _actionSelectShipping)
274+
: wsCheckoutRow(
275+
context,
276+
heading:
277+
trans(context, "Select shipping"),
278+
leadImage: Icon(Icons.local_shipping),
279+
leadTitle: trans(context,
280+
"Select a shipping option"),
281+
action: _actionSelectShipping,
282+
)),
283+
].where((e) => e != null).toList()),
278284
),
279285
),
280286
Column(
@@ -286,14 +292,18 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
286292
thickness: 1,
287293
),
288294
wsCheckoutSubtotalWidgetFB(
289-
title: trans(context, "Subtotal")),
290-
widgetCheckoutMeta(context,
291-
title: trans(context, "Shipping fee"),
292-
amount:
293-
CheckoutSession.getInstance.shippingType == null
294-
? trans(context, "Select shipping")
295-
: CheckoutSession.getInstance.shippingType
296-
.getTotal(withFormatting: true)),
295+
title: trans(context, "Subtotal"),
296+
),
297+
app_disable_shipping == true
298+
? null
299+
: widgetCheckoutMeta(context,
300+
title: trans(context, "Shipping fee"),
301+
amount:
302+
CheckoutSession.getInstance.shippingType ==
303+
null
304+
? trans(context, "Select shipping")
305+
: CheckoutSession.getInstance.shippingType
306+
.getTotal(withFormatting: true)),
297307
(_taxRate != null
298308
? wsCheckoutTaxAmountWidgetFB(taxRate: _taxRate)
299309
: null),
@@ -322,7 +332,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
322332
Padding(
323333
padding: const EdgeInsets.only(top: 15),
324334
child: Text(
325-
trans(context, "One moment") + "...",
335+
"${trans(context, "One moment")}...",
326336
style: Theme.of(context).primaryTextTheme.subtitle1,
327337
),
328338
)
@@ -358,7 +368,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
358368
return;
359369
}
360370

361-
if (CheckoutSession.getInstance.shippingType == null) {
371+
if (app_disable_shipping == false &&
372+
CheckoutSession.getInstance.shippingType == null) {
362373
showEdgeAlertWith(
363374
context,
364375
title: trans(context, "Oops"),
@@ -380,7 +391,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
380391
return;
381392
}
382393

383-
if (CheckoutSession.getInstance.shippingType.minimumValue != null) {
394+
if (app_disable_shipping == false &&
395+
CheckoutSession.getInstance.shippingType.minimumValue != null) {
384396
String total = await Cart.getInstance.getTotal();
385397
if (total == null) {
386398
return;

LabelStoreMax/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Official WooSignal App Template for WooCommerce
22

33
# Label StoreMax
4-
# Version 2.3.0
4+
# Version 2.4.0
55
# Homepage: https://woosignal.com
66
# Author: Anthony Gordon <[email protected]>
77
# Documentation: https://woosignal.com/docs/app/ios/label-storemax

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# WooCommerce App: Label StoreMax
66

7-
### Label StoreMax - v2.3.0
7+
### Label StoreMax - v2.4.0
88

99

1010
[Official WooSignal WooCommerce App](https://woosignal.com)

0 commit comments

Comments
 (0)