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

View File

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

View File

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

View File

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