13

In Magento 2.2.4, Tier price of a simple product does not appear on a configurable product page after editing the cart.

Steps to reproduce:

1)Select all option of configurable product which has a tier price.
This show tier price in product detail page
2)Add a product to cart
3)Got to the checkout cart page
4)Click an edit button of the product. It redirects to the product detail page and there is no tier price is visible.

You can see a screenshot for the better idea.

First Time(before edit) enter image description here

After Edit(on checkout page) enter image description here

  • In Magento when we edit cart item then after redirecting it does not show tier price at that time when you will click on its attribute options then it will show you tier prices it is issue by default. – Charul Tyagi Aug 8 '18 at 8:18
3

This because you are using the custom theme, so the update cart template was changed.

Please check vendor/magento/module-configurable-product/view/base/templates/product/price/tier_price.phtml to see how tier prices are shown on product page and then fix your theme.

I checked default Magento2, it is working like my screenshot:

enter image description here

| improve this answer | |
1

The accepted answer could be related broadly - but I think the original issue posted is specifically to do with Swatches, as we've just found the same issue.

Symptom: When you load a configurable product which uses swatches, by using a url hash to set the options, the correct swatch is selected, but the tier price block doesnt render.

Url will look something like: www.domain.com/my-conf-product#153=22

I've traced the issue to;

/vendor/magento/module-swatches/view/base/web/js/swatch-renderer.js

Copy this file to your own theme, here;

/app/design/frontend/yourvendor/yourtheme/Magento_Swatches/web/js/swatch-renderer.js

The problem is around line 958, in the function _UpdatePrice, where 'this.options.tierPriceTemplate' is not defined on load, change this:

_UpdatePrice: function () {
        var $widget = this,
            $product = $widget.element.parents($widget.options.selectorProduct),
            $productPrice = $product.find(this.options.selectorProductPrice),
            result = $widget._getNewPrices(),
            tierPriceHtml,
            isShow;

        $productPrice.trigger(
            'updatePrice',
            {
                'prices': $widget._getPrices(result, $productPrice.priceBox('option').prices)
            }
        );

        isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount;

        $product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide']();

        if (typeof result != 'undefined' && result.tierPrices && result.tierPrices.length) {
            if (this.options.tierPriceTemplate) {
                tierPriceHtml = mageTemplate(
                    this.options.tierPriceTemplate,
                    {
                        'tierPrices': result.tierPrices,
                        '$t': $t,
                        'currencyFormat': this.options.jsonConfig.currencyFormat,
                        'priceUtils': priceUtils
                    }
                );
                $(this.options.tierPriceBlockSelector).html(tierPriceHtml).show();
            }
.....

To this;

_UpdatePrice: function () {
        var $widget = this,
            $product = $widget.element.parents($widget.options.selectorProduct),
            $productPrice = $product.find(this.options.selectorProductPrice),
            result = $widget._getNewPrices(),
            tierPriceHtml,
            isShow;

        $productPrice.trigger(
            'updatePrice',
            {
                'prices': $widget._getPrices(result, $productPrice.priceBox('option').prices)
            }
        );

        isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount;

        $product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide']();

        if (typeof result != 'undefined' && result.tierPrices && result.tierPrices.length) {

            // PIXIE ADDED - THIS IS EMPTY WHEN USING HASH LOAD
            if (this.options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html()) { 
            // PIXIE END

                tierPriceHtml = mageTemplate(
                    this.options.tierPriceTemplate,
                    {
                        'tierPrices': result.tierPrices,
                        '$t': $t,
                        'currencyFormat': this.options.jsonConfig.currencyFormat,
                        'priceUtils': priceUtils
                    }
                );
                $(this.options.tierPriceBlockSelector).html(tierPriceHtml).show();

            }
         ....
| improve this answer | |

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.