<?xml version="1.0"?>
<!--
/**
 * Copyright © MageWorx. All rights reserved.
 * See LICENSE.txt for license details.
 */
 -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <!--
    Replaces group price to special price pricing.
    Plugin used on product, category and search pages.
    -->
    <type name="Magento\Catalog\Pricing\Price\SpecialPrice">
        <plugin name="mageworx_customergroupprices_apply_group_prices_to_special_price_pricing"
                type="MageWorx\CustomerGroupPrices\Plugin\Pricing\AddGroupPricesToSpecialPricePricingPlugin" sortOrder="10" disabled="false"/>
    </type>

    <!--
    Replaces group price to regular price pricing.
    Plugin used on product, category and search pages.
    -->
    <type name="Magento\Catalog\Pricing\Price\RegularPrice">
        <plugin name="mageworx_customergroupprices_apply_group_prices_to_regular_price_pricing"
                type="MageWorx\CustomerGroupPrices\Plugin\Pricing\AddGroupPricesToRegularPricePricingPlugin" sortOrder="10" disabled="false"/>
    </type>

    <!--
    Plugin is used only on magento 2.3.1 and 2.3.1e
    The reason is in vendor/magento/module-catalog/etc/frontend/di.xml
    On this version magento adds:
    <preference for="Magento\Catalog\Model\Product\Type\Price" type="Magento\Catalog\Model\Product\Type\FrontSpecialPrice" />
    -->
    <type name="Magento\Catalog\Model\ResourceModel\Product\Price\SpecialPrice">
        <plugin name="mageworx_customergroupprices_apply_group_prices_to_product_special_price"
                type="MageWorx\CustomerGroupPrices\Plugin\Price\SpecialPrice" sortOrder="10" disabled="false"/>
    </type>

</config>
