Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. var config = {
  2. config: {
  3. mixins: {
  4. 'Magento_Checkout/js/view/summary/abstract-total': {
  5. 'Vendor_Modulename/js/view/summary/abstract-total-mixin': true
  6. },
  7. 'Magento_Checkout/js/view/summary/shipping': {
  8. 'Vendor_Modulename/js/view/summary/shipping-mixin': true
  9. },
  10. }
  11. }};
  12.  
  13. define(
  14. [
  15. 'uiComponent',
  16. 'Magento_Checkout/js/model/step-navigator'
  17. ],
  18. function (Component, stepNavigator) {
  19. "use strict";
  20. return function (abstractTotal) {
  21. return abstractTotal.extend({
  22. isFullMode: function() {
  23. if (!this.getTotals() || stepNavigator.getActiveItemIndex() === 1) {
  24. return false;
  25. }
  26. return true; //add this line to display forcefully summary in shipping step.
  27. }
  28. });
  29. }
  30. });
  31.  
  32. define([
  33. 'jquery',
  34. 'Magento_Checkout/js/view/summary/abstract-total',
  35. 'Magento_Checkout/js/model/quote'
  36. ], function ($, Component, quote) {
  37. 'use strict';
  38. return function (shipping) {
  39. return shipping.extend({
  40. getValue: function () {
  41. var price;
  42.  
  43. if (!this.isCalculated()) {
  44. return this.notCalculatedMessage;
  45. }
  46. //var price = this.totals().shipping_amount; //comment this line
  47.  
  48. var shippingMethod = quote.shippingMethod(); //add these both line
  49. var price = shippingMethod.amount; // update data on change of the shipping method
  50.  
  51. return this.getFormattedPrice(price);
  52. }
  53. });
  54. }});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement