You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
820 B

  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).on('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. });