IS it possible, perhaps using the SDK to blacklist a customer from ordering on the website with snipcart

I was wondering if anyone had a solution for ‘blacklisting’ a customer and preventing them from ordering on the website. I thought perhaps this could be achieved by ‘blacklisting’ either the order email address or the company name or indeed the delivery address, so that any orders with any of the blacklisted data would NOT be processed (either with or without some sort of cart feedback explaining that the order could NOT be processed

Hey @daveharrisonnet,

For the sake of the community, I will share what we came up with.
So basically we want to remove the “place order” button, when a condition is met, in this case we are using customer’s email address, but it could be anything.

On line #3 we check if geeks@snipcart.com is the current customer, if so we hide the payment form. Everything else is the default Payment component nothing has been changed.

  <payment>
    <snipcart-form
      v-if="paymentSession && !['geeks@snipcart.com'].includes(paymentSession.invoice.email)"
      @submit="confirmOrder"
      class="snipcart-payment snipcart__box"
    >
      <div class="snipcart__box--header">
        <div class="snipcart__box--title">
          <div
            class="snipcart__box--badge snipcart__box--badge snipcart__box--badge-highlight snipcart__font--bold snipcart__font--secondary"
          >
            {{ number }}
          </div>
          <h1 class="snipcart-payment__header snipcart__font--subtitle">
            {{ $localize("payment.title") }}
          </h1>
        </div>
      </div>

      <overridable name="payment" section="top"></overridable>

      <div v-if="noPaymentsRequired">
        <p class="snipcart-payment__no-payment">
          {{ $localize('payment.no_payment') }}
        </p>
        <snipcart-submit
          label="payment.place_order"
          label-loading="payment.processing_payment"
          icon="continue-arrow"
        ></snipcart-submit>
      </div>
      <loading-overlay
        v-else
        class="snipcart-payment__loading"
        :message="$localize('payment.preparing_payment_session')"
        :opaque="true"
        :componentIsLoading="false"
      >
        <snipcart-form-error fallback="payment_failed"></snipcart-form-error>
        <div
          v-if="authorizationFlowIsForm"
          class="snipcart-payment__form-container"
          :class="{'snipcart-payment__form-container--loading': loading}"
        >
          <payment-form
            :payment-method="paymentSession.paymentMethod"
            :key="paymentSession.paymentMethod"
            :disabled="paymentMethodCurrentlyChanging"
            :payment-currently-proccessing="paymentCurrentlyProccessing"
          >
          </payment-form>
        </div>

        <hr
          v-if="authorizationFlowIsForm && hasRedirectPaymentMethod"
          class="snipcart-form__separator"
        />

        <payment-methods-list
          :disabled="paymentCurrentlyProccessing"
        ></payment-methods-list>
      </loading-overlay>

      <overridable name="payment" section="bottom"></overridable>
    </snipcart-form>
  </payment>
1 Like