#StackBounty: #checkout #magento-2.2.5 Magento 2.2.5 checkout page summary discount row shows as expanded

Bounty: 50

In Magento2.2.5 using the default Magento2 2 step checkout on the payment & review step in the order summary box the discount which I believe is suppose to be a drop down shows always as expanded and I would like it not to always be expanded by default. See the screenshot below. Where and how do I make that not be auto-expanded? I looked in vendor/magento/module-checkout/view/frontend/web/template/summary but not sure what file would be edited and how. of course I will move the file to my theme once I know which one needs to be edited.
see screenshot

enter image description here


Get this bounty!!!

#StackBounty: #magento2 #checkout #payment-methods Not rendering specific payment method in template

Bounty: 50

I’m looking to stop a specific payment method (check / money order) from displaying on the checkout page. I can’t disable the payment method, as I still need it to be used by the API on another checkout.

Doing some digging I can see this part loops through all the payment methods –

/vendor/magento/module-checkout/view/frontend/web/template/payment-methods/list.html

<each args="data: getRegion($group().displayArea), as: 'method'" render=""/> </div>

I’ve tried to add in some logic of “if paymentMethod code = ‘checkmo’ don’t display” = But I can’t seem to do it this way, it gets rid of displaying any payment methods.

Would this be the best approach to do what I need, or is there another way?


Get this bounty!!!

#StackBounty: #checkout #magento2.2.6 #checkout-page #custom-field #datepicker How to add datepicker field in Checkout?

Bounty: 50

I want to add a date picker field into the checkout page but I have no idea where to start.

I have tried this Add date picker in checkout page but it’s not working for me.

We are having the below folder structure:

appcodesivamymoduleviewfrontendwebtemplateshipping.html

In shipping.html, we have the form which needs to be shown on the frontend.

Now, can I add both the HTML input field and JS in the same file, shipping.html?

If anyone got the delivery date field works in Checkout, please help me with this.

Updated Code in shipping-mixin.js:

   define([
    'jquery',
    'underscore',
    'Magento_Ui/js/form/form',
    'ko',
    'Magento_Customer/js/model/customer',
    'Magento_Customer/js/model/address-list',
    'Magento_Checkout/js/model/address-converter',
    'Magento_Checkout/js/model/quote',
    'Magento_Checkout/js/action/create-shipping-address',
    'Magento_Checkout/js/action/select-shipping-address',
    'Magento_Checkout/js/action/create-billing-address',
    'Magento_Checkout/js/action/select-billing-address',
    'Magento_Checkout/js/action/set-shipping-information',
    'Magento_Checkout/js/model/step-navigator',
    'Magento_Checkout/js/checkout-data',
    'mage/translate'
], function(
    $,
    _,
    Component,
    ko,
    customer,
    addressList,
    addressConverter,
    quote,
    createShippingAddress,
    selectShippingAddress,
    createBillingAddress,
    selectBillingAddress,
    setShippingInformationAction,
    stepNavigator,
    checkoutData,
    $t
) {
    'use strict';
    $('#conform-account-scola-btn').prop('disabled', false);
    $('#onepage-guest-register-button').prop('disabled', false);
    $('#loa').hide(); 
    return function (target) {
        return target.extend({
            defaults: {
                template: 'DCKAP_School/shipping'
            },
            setShippingInformation: function () {
                var flag=false;
                var count = 0;
                var scrollTo = '';
                if($('input[name=school-or-private-person]').val() == 'school'){

                    $(".school-required-entry").each(function() {
                        if (this.value == 0 || this.value == '') {
                            count++;
                            //$(this).next('.school_err').html("This is a required field.");
                $(this).next('.school_err').html("Vänligen fyll i detta obligatoriska fält.");
                            $(this)[0].style.borderColor = "#ed8380";
                            $(this).next('.school_err').css("display", "block");
                            if(count==1){
                                scrollTo = "#"+$(this).attr('id');
                            }
                            flag=true;
                        }else{
                            $(this).next('.school_err').html('');
                $(this)[0].style.borderColor = "";
                            if(this.value != '')
                            {
                              if($("#school-display").css('display') == 'block' ){
                               $("#schoolsearch").next('.school_err').html("Vänligen klicka på din skola från listan nedan");
                               $("#schoolsearch").next('.school_err').css("display","block");
                               $("#schoolsearch").css("borderColor", "#ed8380");
                   $("html, body").animate({ scrollTop: 180 }, "slow");
                              }
                            } 
                        }
                    });

                    if (flag) {
                        if($("#school-display").css('display') == 'block' ){
                          $("html, body").animate({ scrollTop: 180 }, "slow");
                        }
                        else
                        {
                          $('html, body').animate({
                            scrollTop: $(scrollTo).offset().top
                          });  
                        }                        
                        return false;
                    }
                var firstname = $('#dc_shipping_firstname').val();
                var lastname = $('#dc_shipping_lastname').val();
                $('#shipping-new-address-form [name="firstname"]').val(firstname).keyup();
                $('#shipping-new-address-form [name="lastname"]').val(lastname).keyup();
                $('#billing-address-form [name="firstname"]').val(firstname).keyup();
                $('#billing-address-form [name="lastname"]').val(lastname).keyup();

                }
                else if ($('input[name=school-or-private-person]').val() == 'private')
                {
                   if ($("#customer-email").val() == 0 || $("#customer-email").val() == '') {
                    $("#customer-email").css("borderColor","#ed8380");
                    $(".input-text.mage-error").next('.school_err').css("display","none");
                    $("#customer-email-error").html("Vänligen fyll i detta obligatoriska fält."); 
                   }
                } 

                if (this.validateShippingInformation() && this.validateBillingInformation()) {
                    setShippingInformationAction().done(
                        function () {
                            $("#majema-school").hide();
                            $("#place-order-trigger-wrapper").show();
                            $("#custom-info").appendTo("#co-payment-form");
                            $('#custom-shipping-method-buttons-container').hide();
                            $('#custom-subtotal').hide();
                            $('.opc-block-summary .table-totals').show();
                            stepNavigator.next();
                        }
                    );
                }
            },
            validateBillingInformation: function() {

                if($('[name="billing-address-same-as-shipping"]').is(":checked")) {
                    if (this.isFormInline) {
                        var shippingAddress = quote.shippingAddress();
                        var addressData = addressConverter.formAddressDataToQuoteAddress(
                            this.source.get('shippingAddress')
                        );
                        //Copy form data to quote shipping address object
                        for (var field in addressData) {

                            if (addressData.hasOwnProperty(field) &&
                                shippingAddress.hasOwnProperty(field) &&
                                typeof addressData[field] != 'function' &&
                                _.isEqual(shippingAddress[field], addressData[field])
                            ) {
                                shippingAddress[field] = addressData[field];
                            } else if (typeof addressData[field] != 'function' &&
                                !_.isEqual(shippingAddress[field], addressData[field])) {
                                shippingAddress = addressData;
                                break;
                            }
                        }

                        if (customer.isLoggedIn()) {
                            shippingAddress.save_in_address_book = 1;
                        }
                        var newBillingAddress = createBillingAddress(shippingAddress);
                        selectBillingAddress(newBillingAddress);
                    } else {
                        selectBillingAddress(quote.shippingAddress());
                    }

                    return true;
                }

                var selectedAddress = $('[name="billing_address_id"]').val();
                if(selectedAddress) {
                    var res = addressList.some(function (addressFromList) {
                        if (selectedAddress == addressFromList.customerAddressId) {
                            selectBillingAddress(addressFromList);
                            return true;
                        }
                        return false;
                    });

                    return res;
                }

                this.source.set('params.invalid', false);
                this.source.trigger('billingAddress.data.validate');

                if (this.source.get('params.invalid')) {
                    return false;
                }

                var addressData = this.source.get('billingAddress'),
                    newBillingAddress;

                if ($('#billing-save-in-address-book').is(":checked")) {
                    addressData.save_in_address_book = 1;
                }

                newBillingAddress = createBillingAddress(addressData);
                selectBillingAddress(newBillingAddress);

                return true;
            }

        });


initialize: function () {
                    this._super();
                    ko.bindingHandlers.datetimepicker = {
                        init: function (element, valueAccessor, allBindingsAccessor) {
                            var $el = $(element);
                            //initialize datetimepicker
                            var options = {
                                minDate: 0,
                                dateFormat: 'yy-mm-dd'
                            };

                            $el.datetimepicker(options);

                            var writable = valueAccessor();
                            if (!ko.isObservable(writable)) {
                                var propWriters = allBindingsAccessor()._ko_property_writers;
                                if (propWriters && propWriters.datetimepicker) {
                                    writable = propWriters.datetimepicker;
                                } else {
                                    return;
                                }
                            }
                            writable($(element).datetimepicker("getDate"));
                        },
                        update: function (element, valueAccessor) {
                            var widget = $(element).data("DateTimePicker");
                            //when the view model is updated, update the widget
                            if (widget) {
                                var date = ko.utils.unwrapObservable(valueAccessor());
                                widget.date(date);
                            }
                        }
                    };

                    return this;
                }    
    }
});

Error in the console:

enter image description here


Get this bounty!!!

#StackBounty: #magento2 #checkout #modal Modal error in checkout

Bounty: 50

In default magento checkout page, mobile version, clicking the minicart icon opens a modal containing cart contents.

When checkout page is loaded for the first time, clicking that minicart icon gives javascript error:

Uncaught TypeError: No method named "openModal"
    at HTMLDivElement.<anonymous> (bootstrap.min.js:6)
    at Function.each (jquery.js:370)
    at jQuery.fn.init.each (jquery.js:137)
    at jQuery.fn.init.o._jQueryInterface [as modal] (bootstrap.min.js:6)
    at Object.show (sidebar.js:24)
    at UiClass.showSidebar (estimation.js:44)
    at HTMLButtonElement.<anonymous> (knockout.js:4255)
    at HTMLButtonElement.dispatch (jquery.js:5226)
    at HTMLButtonElement.elemData.handle (jquery.js:4878)

After refreshing page, modal opens normally.

Modal is defined in file vendor/magento/module-checkout/view/frontend/web/template/sidebar.html:

</div>

Is there any way to fix this and force Magento_Ui/js/modal/modal to load earlier in page? Any ideas?


Get this bounty!!!

#StackBounty: #magento2 #checkout #shipping-methods Remove specific shipping method based on condition in magento 2

Bounty: 50

I have installed a store pick up extension in our website.

This extension showing two option as radio buttons

Collect in Store

Yes

No

So if we select ‘NO’, then in shipping method,

There is an additional shipping method showing like below.

Store pickup 0.00

Can we hide this option from the list if the extension installed is enabled.

In which file we can hide specific shipping method based on condition.

Can anyone help me with the issue.

I need to hide the specific shipping method from the list of options.

Thanks in Advance


Get this bounty!!!

#StackBounty: #checkout #magento2.2 #payment-methods #paypal PayPal All-In-One Payment Solution – Clone to multiple options in checkout…

Bounty: 100

TLDR; Clone “PayPal All-In-One Payment Solution” payment method to have THREE different payment methods in “Payment Options” section of the checkout process.


Magento 2 comes with “PayPal All-In-One Payment Solution” that enables user to pay by PayPal but also by credit/debit card through the same payment method.

When this option is enabled, it shows only ONE payment option in the checkout process. This is understandable, however, I would like to offer more than one payment option in the checkout “Payment Method” section such as “Credit Card”, “Debit Card” and “PayPal” which all go to the same place.

In conclusion, my goal is to create two more radio buttons in the “Payment Method” section of the checkout that mimic “PayPal All-In-One Payment Solution” logic.

To visualise my goal:

Current setup:

PayPal Payment ---- [PayPal Method]

Desired result:

Credit Card ---
Debit Card  ----- [PayPal Method]
PayPal      --- 

I don’t even know where to start so any help or directions will be highly appreciated.


Get this bounty!!!

#StackBounty: #magento2 #checkout #orders #paypal Magento 2 Paypal Express Checkout order on hold

Bounty: 50

I’ve set up a Magento 2.3.0 shop, and as a payment method, I’m also using Paypal express checkout.
The “Payment Action” is set to “Authorization”, and I have received an order a few days ago, the amount is shown in the paypal account on hold, saying “Authorization”.
Is there anything else I should do in order to actually receive the amount?


Get this bounty!!!