Magento2: Magento 2 reorder function not working properly

Created on 11 Aug 2016  路  14Comments  路  Source: magento/magento2

Preconditions

  1. Magento 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0, PHP 7.0.x, MySQL 5.6.x
  2. Any browser

Steps to reproduce

  1. login as customer, navigate to Account Dashboard, or Order List;
  2. On any existing order item, click "Reorder" button;
  3. The result shopping cart page shows item from previous order is added. however the bag icon is not updated, and popup minicart doesn't have the reorder item;

Expected result

  1. The bag icon and minicart should be updated accordingly.

Screenshots

  1. Resulting shopping cart
  2. Customer Dashboard, Order List
    3, Link to demo store
Sales Format is not valid Ready for Work bug report

All 14 comments

+1. Our platform: M2.1
Please fix on priority or provide a workaround.

blank

Please assign and act on this on priority. This looks like a major functional issue.

Hi @simonxy @apurv-anand

Thank you for reporting the issue. It is reported as MAGETWO-54964 internally.

Thanks,
Kateryna.

Experiencing the same issue here on Magento 2.1.
The mini cart does not get updated in result of the reorder.
Browser's local storage where the mini cart is cached only gets refreshed upon POST/PUT requests.
However, the reorder action is a regular link that results in an ordinary GET request.

The issue is resolved and will be available in 2.1.2 patch version.

Hey @katmoon,

Is there a commit or work around we can use until the next release?

Hi @brideo

The fix will be available with the next non-security patch release.

@brideo,

I don't have access to the official patch, but I can share the workaround we use.
The idea is to listen to the reorder link clicks and invalidate the customer data in the local storage.

The Workaround
Add the following JavaScript to pages with the reorder links (via layout handle customer_account):

require([
    'jquery',
    'Magento_Customer/js/section-config',
    'Magento_Customer/js/customer-data',
    'domReady!'
], function ($, sectionConfig, customerData) {
    'use strict';

    /**
     * Elements - Reorder links
     */
    var s = [
        '.sales-order-view .order-actions-toolbar .actions .reorder',       // sales-order-view
        '.sales-order-history .table-order-items .actions .order',          // sales-order-history
        '.customer-account-index .table-order-items .actions .order',       // customer-account-index
    ];

    /**
     * Events listener
     */
    $(s.join(', ')).on('click', function(event) {
        var sections;

        // anchor contains span, target may be span instead of anchor
        var el = event.target.href ? event.target : event.target.parentElement;

        // check if this is really a redirect link
        if (el.href.match(/reorder/i)) {
            sections = sectionConfig.getAffectedSections(el.href);

            if (sections) {
                customerData.invalidate(sections);
            }
        }
    });

});

Please note that the official unreleased fix is likely very different from the workaround above. It probably changes the request method from GET to POST to match semantics of the operation: entity creation rather than retrieval.

Brilliant thanks @sshymko!

I will make a note to remove it when the next version of Magento is released.

This issue was fixed in 2.1.2. 2.0.10 and develop branch.
Closed.

@veloraven can you please bring us a link to the commit where this issue was fixed in 2.1 branch?

@veloraven @katmoon
Can you please do as @Bartlomiejsz asked and supply a reference to where/how this was fixed? Also in what release was this fixed in?

I'm still experiencing this on 2.1.5. I'm guessing that the previous (bad) vendor who made this site overwrote something, so the problem still exists..

Issue still exists on magento 2.1.8, old prices not updating when reordering...
Any solution?

Similar issue here #30663

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jzalenski picture jzalenski  路  3Comments

xi-ao picture xi-ao  路  3Comments

andreaskoch picture andreaskoch  路  3Comments

BenSpace48 picture BenSpace48  路  3Comments

kirashet666 picture kirashet666  路  3Comments