Magento2: Product custom option price scope issue

Created on 15 Aug 2016  路  7Comments  路  Source: magento/magento2

It is not possible to change the price of custom options at different scopes. If you change the scope when editing a product and change the price of a custom option the value is changed across all scopes. This functionality was present in Magento 1.

Steps to reproduce

  1. Create a Magento environment with multiple websites and store views
  2. Create a simple product
  3. Add a custom option to the product with different values with different pricing
  4. Save the product
  5. Change the store view scope you are editing in and change the pricing of the custom options
  6. Save
  7. Review the custom option pricing at default and other storeview scopes

    Expected result

Price of the custom option should be different at the storeview scope.

Actual result

Price of the custom option is changed to the new value at all scope levels

improvement

All 7 comments

@alexgoodey Please, provide the used Magento version.

Magento CE 2.1.0

Thank you for your submission.

We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues.

Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here).

We are closing this GitHub ticket and have moved your request to the new forum.

@piotrekkaminski @antboiko Is this problem solved ?
I have the same problem when editing the product.
My magento version is Magento CE 2.1.0
Thanks

@piotrekkaminski
We've reproduced the issue on the latest Magento 2.1.7 and upcoming 2.2 (and latest Magento 1.x).
This is a major problem especially for multi-currency websites, not a feature request.
Imagine USD and EUR websites selling the same SKU with custom option w surcharge.
Obviously, the price amount needs to be different in different currencies.
This bug prevents saving unique surcharge amount for each website.

Please reopen the ticket.
Thanks.

@alexgoodey
The following Precondition is necessary to reproduce the test case:
Configuration > Catalog > Price > Catalog Price Scope: Website

Otherwise the prices are Global and don't vary per Website.

The workaround in a form of a custom module.
Tested on Magento 2.1.4.

File app/code/Example/CatalogOptionFix/Model/ResourceModel/Product/Option/Value.php:

<?php
namespace Example\CatalogOptionFix\Model\ResourceModel\Product\Option;

class Value extends \Magento\Catalog\Model\ResourceModel\Product\Option\Value
{
    protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $object)
    {
        $originalStoreId = $object->getStoreId();
        $storeId = $originalStoreId === null ? true : $originalStoreId;
        $object->setStoreId($storeId);
        try {
            parent::_saveValuePrices($object);
        } finally {
            $object->setStoreId($originalStoreId);
        }
    }
}

File app/code/Example/CatalogOptionFix/etc/di.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Model\ResourceModel\Product\Option\Value" type="Example\CatalogOptionFix\Model\ResourceModel\Product\Option\Value"/>
</config>
Was this page helpful?
0 / 5 - 0 ratings