1

I have managed to get configurable product options to display on the product list page of a category. The add to cart function works correctly too and adds the correct product variation to the cart. My only issue is to do with the price of the configurable products. If I choose a product variance (that has a different price to the base price) from the configurable product dropdown all the configurable product prices change. I have managed to track down the code that is used to change the price ( module-catalog\view\base\web\js\price-box.js line 136) but cant seem to figure out how to restrict the other prices from changing. The code in question is below:

/**
     * Render price unit block.
     */
   reloadPrice: function reDrawPrices() {
        var priceFormat = (this.options.priceConfig && this.options.priceConfig.priceFormat) || {},
            priceTemplate = mageTemplate(this.options.priceTemplate);

        _.each(this.cache.displayPrices, function (price, priceCode) {
            price.final = _.reduce(price.adjustments, function(memo, amount) {
                return memo + amount;
            }, price.amount);

            price.formatted = utils.formatPrice(price.final, priceFormat);

            $('[data-price-type="' + priceCode + '"]', this.element).html(priceTemplate({data: price}));
        }, this);
    },

Any help with this would be much appreciated.

  • Hi Martin - Did you solve this? Can you explain how you manage to solve the whole problem e.g. how you managed to output the attribute options too. Thanks – Tom Burman Jan 24 at 17:04

Your Answer

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

Browse other questions tagged or ask your own question.