1

So I've already seen a couple of the other answers to this question on the site, however, my problem is still persisting.

Whenever someone tries to purchase an item using PayPal Express, when they click "Pay Now" it sends them to the Magento Review Page and throws the error "Please specify shipping method". However, if the user goes back to the PayPal Express page, and tries to pay again, it will go through just fine.

Whilst digging through the Magento files to try and see the issue, I've tried the following things.

Set the Timeout Callback on the shipping options to 6s

Added

/**
 * Start Customization
 */
    if (!$rate) {
     Mage::logException(new Exception("Rate was empty inside quote validate method, trying to forcefully recalculate"));
     $this->getQuote()->getShippingAddress()->setCollectShippingRates(true);
     $this->getQuote()->setTotalsCollectedFlag(false);
     $this->getQuote()->collectTotals();
     $rate  = $address->getShippingRateByCode($method);
    }
/** End Customization **/

From This Question

And I've tried logging the entire process.

What I've gathered from everything is that it looks as though Magento isn't picking up the Shipping Method returned by PayPal, as the Method and Rate from the function _validate() (in /app/code/community/sale/service/quote.php) are Both empty when the pay now action is processed.

Paypal is definitely returning the shipping methods too.

If you need any extra code etc, just comment below.

Any help would be greatly appreciated. :)

Thanks!

  • Did you reproduced the described error locally in paypal sandbox? Maybe you have some troubles with cookies, cookiedomain or something like that. As you have already said - from 2nd time issue is not reproducing - try to diff cookie state before and after. – zhartaunik Jul 30 '15 at 12:41
  • I can consistently reproduce the error using the paypal sandbox. Which cookies would I be looking to change? – Benjamin Jul 30 '15 at 12:56
  • Exactly don't know. I'd recommend you to look you you have same frontend cookie (it should not changed), checked cookie domain, etc. If you have local copy - debug only when you disable every module. Maybe some 3rd party extension do smth with sessions, etc. – zhartaunik Jul 30 '15 at 13:00
  • Did you find an answer for this? – Dylan Orr Sep 30 '15 at 16:04
  • We have the same error. Terrible! Any solution that is known to work? I appreciate anhy tips/advice – snh_nl Sep 6 '18 at 20:29
0

We have had the exact same error. Flow is like :

  • Magento cart
  • In cart click paypal express
  • Click ok continue etc paypal
  • Return to Magento paypal/express/review page (template/paypal/express/review.phtml)

case

a. If I set no shipping method and click continue I see the error "Please specify a shipping method"

b. If a shipping method is prepopulated thus the select element is set and I only click continue I see the error "Please specify a shipping method"

c. If we set the select element through JS to a default vallue only if it is unset even then I see the error "Please specify a shipping method"

ridiculous fix

It is an almost ridiculous fix, but it works. We added the following code to force the select value to a certain default if empty, and even if already on the default value. After that we trigger the updateshippingmethod button click and submit.

Actual problem

The only problem we actually had was that - coming back from Paypal the Shipping Method was empty and users needed to select a shipping method. The problem was that customers clicked CONTINUE like 10 times before they noticed the error (or abandoned) - So we decided to auto-set a default shipping method. Only this 'setting' of the default shipping method does somehow not transfer to the quote

I am very open to alternative fixes

Fix

<script type="text/javascript">
    //<![CDATA[
    // submit buttons are not needed when submitting with ajax
    $('review_submit').hide();
    if ($('update_shipping_method_submit')) {
        $('update_shipping_method_submit').hide();
    }

        var selectThis = 'postnl_matrixrate';
        var ppcookieName = 'paypalexpress';
        var selectOption = $("shipping_method").getValue();
        var selectCookie = Mage.Cookies.get(ppcookieName);
        if ((selectOption == '' || selectOption == selectThis) && !selectCookie) {
            $$('select#shipping_method option').each(function(o) {
                if(o.readAttribute('value') == selectThis) { // note, this compares strings
                    o.selected = true;
                    Mage.Cookies.set(ppcookieName,'clicked');
                    $('update_shipping_method_submit').click();
                    // throw $break; // remove this if it's a multi-select
                }
            });
        }

    <?php if ($this->getUseAjax()):?>
    OrderReviewController.prototype._submitOrder = function() {
        <?php /** SNH CUSTOM 7-9-2018 Need to trigger a button click here to respect the pre-selected shipping method **/?>

        $('update_shipping_method_submit').click();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.