v2.4.0 Option to disable shipping in config

This commit is contained in:
Anthony 2020-11-19 13:37:47 +00:00
parent b2df6c5224
commit 4e605bb8c4
6 changed files with 107 additions and 86 deletions

View File

@ -1,3 +1,7 @@
## [2.4.0] - 2020-11-19
* Option to disable shipping in config
## [2.3.0] - 2020-11-18 ## [2.3.0] - 2020-11-18
* Option to set if prices include tax * Option to set if prices include tax

View File

@ -73,6 +73,7 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
orderWC.billing = billing; orderWC.billing = billing;
Shipping shipping = Shipping(); Shipping shipping = Shipping();
shipping.firstName = billingDetails.shippingAddress.firstName; shipping.firstName = billingDetails.shippingAddress.firstName;
shipping.lastName = billingDetails.shippingAddress.lastName; shipping.lastName = billingDetails.shippingAddress.lastName;
shipping.address1 = billingDetails.shippingAddress.addressLine; shipping.address1 = billingDetails.shippingAddress.addressLine;
@ -86,6 +87,7 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
orderWC.shipping = shipping; orderWC.shipping = shipping;
orderWC.shippingLines = []; orderWC.shippingLines = [];
if (app_disable_shipping == false) {
Map<String, dynamic> shippingLineFeeObj = Map<String, dynamic> shippingLineFeeObj =
CheckoutSession.getInstance.shippingType.toShippingLineFee(); CheckoutSession.getInstance.shippingType.toShippingLineFee();
if (shippingLineFeeObj != null) { if (shippingLineFeeObj != null) {
@ -95,6 +97,7 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
shippingLine.total = shippingLineFeeObj['total']; shippingLine.total = shippingLineFeeObj['total'];
orderWC.shippingLines.add(shippingLine); orderWC.shippingLines.add(shippingLine);
} }
}
if (taxRate != null) { if (taxRate != null) {
orderWC.feeLines = []; orderWC.feeLines = [];

View File

@ -16,7 +16,7 @@ import 'dart:ui';
Developer Notes Developer Notes
SUPPORT EMAIL - support@woosignal.com SUPPORT EMAIL - support@woosignal.com
VERSION - 2.3.0 VERSION - 2.4.0
https://woosignal.com https://woosignal.com
*/ */
@ -41,6 +41,8 @@ const app_currency_iso = "gbp";
const app_products_prices_include_tax = true; const app_products_prices_include_tax = true;
const app_disable_shipping = false;
const Locale app_locale = Locale('en'); const Locale app_locale = Locale('en');
const List<Locale> app_locales_supported = [ const List<Locale> app_locales_supported = [

View File

@ -12,6 +12,7 @@ import 'package:flutter/material.dart';
import 'package:label_storemax/app_payment_methods.dart'; import 'package:label_storemax/app_payment_methods.dart';
import 'package:label_storemax/app_state_options.dart'; import 'package:label_storemax/app_state_options.dart';
import 'package:label_storemax/helpers/tools.dart'; import 'package:label_storemax/helpers/tools.dart';
import 'package:label_storemax/labelconfig.dart';
import 'package:label_storemax/models/cart.dart'; import 'package:label_storemax/models/cart.dart';
import 'package:label_storemax/models/checkout_session.dart'; import 'package:label_storemax/models/checkout_session.dart';
import 'package:label_storemax/models/customer_address.dart'; import 'package:label_storemax/models/customer_address.dart';
@ -219,9 +220,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
heading: trans( heading: trans(
context, "Billing/shipping details"), context, "Billing/shipping details"),
leadImage: Icon(Icons.home), leadImage: Icon(Icons.home),
leadTitle: (CheckoutSession leadTitle:
.getInstance.billingDetails == (CheckoutSession.getInstance.billingDetails == null ||
null ||
CheckoutSession.getInstance CheckoutSession.getInstance
.billingDetails.billingAddress .billingDetails.billingAddress
.hasMissingFields() .hasMissingFields()
@ -233,7 +233,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
action: _actionCheckoutDetails, action: _actionCheckoutDetails,
showBorderBottom: true) showBorderBottom: true)
: wsCheckoutRow(context, : wsCheckoutRow(context,
heading: trans(context, "Billing/shipping details"), heading:
trans(context, "Billing/shipping details"),
leadImage: Icon(Icons.home), leadImage: Icon(Icons.home),
leadTitle: trans(context, "Add billing & shipping details"), leadTitle: trans(context, "Add billing & shipping details"),
action: _actionCheckoutDetails, action: _actionCheckoutDetails,
@ -245,7 +246,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
image: AssetImage("assets/images/" + image: AssetImage("assets/images/" +
CheckoutSession.getInstance CheckoutSession.getInstance
.paymentType.assetImage), .paymentType.assetImage),
width: 70), width: 70,
),
leadTitle: CheckoutSession leadTitle: CheckoutSession
.getInstance.paymentType.desc, .getInstance.paymentType.desc,
action: _actionPayWith, action: _actionPayWith,
@ -253,13 +255,17 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
: wsCheckoutRow(context, : wsCheckoutRow(context,
heading: trans(context, "Pay with"), heading: trans(context, "Pay with"),
leadImage: Icon(Icons.payment), leadImage: Icon(Icons.payment),
leadTitle: leadTitle: trans(
trans(context, "Select a payment method"), context, "Select a payment method"),
action: _actionPayWith, action: _actionPayWith,
showBorderBottom: true)), showBorderBottom: true)),
(CheckoutSession.getInstance.shippingType != null app_disable_shipping == true
? null
: (CheckoutSession.getInstance.shippingType !=
null
? wsCheckoutRow(context, ? wsCheckoutRow(context,
heading: trans(context, "Shipping selected"), heading:
trans(context, "Shipping selected"),
leadImage: Icon(Icons.local_shipping), leadImage: Icon(Icons.local_shipping),
leadTitle: CheckoutSession leadTitle: CheckoutSession
.getInstance.shippingType .getInstance.shippingType
@ -267,14 +273,14 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
action: _actionSelectShipping) action: _actionSelectShipping)
: wsCheckoutRow( : wsCheckoutRow(
context, context,
heading: trans(context, "Select shipping"), heading:
trans(context, "Select shipping"),
leadImage: Icon(Icons.local_shipping), leadImage: Icon(Icons.local_shipping),
leadTitle: trans( leadTitle: trans(context,
context, "Select a shipping option"), "Select a shipping option"),
action: _actionSelectShipping, action: _actionSelectShipping,
)), )),
], ].where((e) => e != null).toList()),
),
), ),
), ),
Column( Column(
@ -286,11 +292,15 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
thickness: 1, thickness: 1,
), ),
wsCheckoutSubtotalWidgetFB( wsCheckoutSubtotalWidgetFB(
title: trans(context, "Subtotal")), title: trans(context, "Subtotal"),
widgetCheckoutMeta(context, ),
app_disable_shipping == true
? null
: widgetCheckoutMeta(context,
title: trans(context, "Shipping fee"), title: trans(context, "Shipping fee"),
amount: amount:
CheckoutSession.getInstance.shippingType == null CheckoutSession.getInstance.shippingType ==
null
? trans(context, "Select shipping") ? trans(context, "Select shipping")
: CheckoutSession.getInstance.shippingType : CheckoutSession.getInstance.shippingType
.getTotal(withFormatting: true)), .getTotal(withFormatting: true)),
@ -322,7 +332,7 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
Padding( Padding(
padding: const EdgeInsets.only(top: 15), padding: const EdgeInsets.only(top: 15),
child: Text( child: Text(
trans(context, "One moment") + "...", "${trans(context, "One moment")}...",
style: Theme.of(context).primaryTextTheme.subtitle1, style: Theme.of(context).primaryTextTheme.subtitle1,
), ),
) )
@ -358,7 +368,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
return; return;
} }
if (CheckoutSession.getInstance.shippingType == null) { if (app_disable_shipping == false &&
CheckoutSession.getInstance.shippingType == null) {
showEdgeAlertWith( showEdgeAlertWith(
context, context,
title: trans(context, "Oops"), title: trans(context, "Oops"),
@ -380,7 +391,8 @@ class CheckoutConfirmationPageState extends State<CheckoutConfirmationPage> {
return; return;
} }
if (CheckoutSession.getInstance.shippingType.minimumValue != null) { if (app_disable_shipping == false &&
CheckoutSession.getInstance.shippingType.minimumValue != null) {
String total = await Cart.getInstance.getTotal(); String total = await Cart.getInstance.getTotal();
if (total == null) { if (total == null) {
return; return;

View File

@ -1,7 +1,7 @@
# Official WooSignal App Template for WooCommerce # Official WooSignal App Template for WooCommerce
# Label StoreMax # Label StoreMax
# Version 2.3.0 # Version 2.4.0
# Homepage: https://woosignal.com # Homepage: https://woosignal.com
# Author: Anthony Gordon <agordon@woosignal.com> # Author: Anthony Gordon <agordon@woosignal.com>
# Documentation: https://woosignal.com/docs/app/ios/label-storemax # Documentation: https://woosignal.com/docs/app/ios/label-storemax

View File

@ -4,7 +4,7 @@
# WooCommerce App: Label StoreMax # WooCommerce App: Label StoreMax
### Label StoreMax - v2.3.0 ### Label StoreMax - v2.4.0
[Official WooSignal WooCommerce App](https://woosignal.com) [Official WooSignal WooCommerce App](https://woosignal.com)