Skip to content

Commit

Permalink
few patches and ability to prioritize pickup
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Jan 3, 2025
1 parent 28492a4 commit 61d1504
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const DefaultConfig = {
googlePay: toBoolean(config('STRIPE_ENABLE_GOOGLE_PAY', false)),
},
showDriversOnMap: toBoolean(config('MAP_DISPLAY_DRIVERS', false)),
prioritizePickup: toBoolean(config('PRIORITIZE_PICKUP', false)),
styles: {
StoreHeader: {
direction: 'column',
Expand Down
6 changes: 6 additions & 0 deletions src/components/CheckoutPickupSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import TabSwitch from './TabSwitch';
import { storefrontConfig } from '../utils';

const CheckoutPickupSwitch = ({ onChange }) => {
const prioritizePickup = storefrontConfig('prioritizePickup');
const receivingOptions = [
{ label: 'Delivery', value: 'delivery' },
{ label: 'Pickup', value: 'pickup' },
];

if (prioritizePickup) {
receivingOptions.reverse();
}

const handleTabChange = (value) => {
const isPickup = value === 'pickup';
if (typeof onChange === 'function') {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/use-qpay-checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getServiceQuote } from '../utils/checkout';
import { numbersOnly } from '../utils/format';
import { percentage, calculateTip } from '../utils/math';
import { getCoordinates } from '../utils/location';
import { get } from '../utils';
import { get, storefrontConfig } from '../utils';
import useStorefront from '../hooks/use-storefront';
import useCurrentLocation from '../hooks/use-current-location';
import useStoreLocations from '../hooks/use-store-locations';
Expand All @@ -27,7 +27,7 @@ export default function useQPayCheckout({ onOrderComplete }) {
tip: 0,
leavingDeliveryTip: false,
deliveryTip: 0,
pickup: 0,
pickup: storefrontConfig('prioritizePickup') ? 1 : 0,
});
const [invoice, setInvoice] = useState();
const [checkoutId, setCheckoutId] = useState();
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/use-stripe-checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function useStripeCheckout({ onOrderComplete }) {
tip: 0,
leavingDeliveryTip: false,
deliveryTip: 0,
pickup: 0,
pickup: storefrontConfig('prioritizePickup') ? 1 : 0,
});
const [serviceQuote, setServiceQuote] = useState(null);
const [isLoading, setIsLoading] = useState(false);
Expand Down

0 comments on commit 61d1504

Please sign in to comment.