proceed-to-checkout.js 814 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'jquery',
  7. 'Magento_Customer/js/model/authentication-popup',
  8. 'Magento_Customer/js/customer-data'
  9. ], function ($, authenticationPopup, customerData) {
  10. 'use strict';
  11. return function (config, element) {
  12. $(element).click(function (event) {
  13. var cart = customerData.get('cart'),
  14. customer = customerData.get('customer');
  15. event.preventDefault();
  16. if (!customer().firstname && cart().isGuestCheckoutAllowed === false) {
  17. authenticationPopup.showModal();
  18. return false;
  19. }
  20. $(element).attr('disabled', true);
  21. location.href = config.checkoutUrl;
  22. });
  23. };
  24. });