1

Is it possible to add 35% more price to products in one category, and also add 16% as tax?

I want products from certain categories to have 35% more prices in catalog price, and then add 16% of taxes in the summary cart.

I tried with price rules but it only applies for discounts. And I don't know if it's possible to add 2 taxes, 1 for catalog price and the other for summary cart.

Greetings!

0

I solved this by creating a Plugin. app/code/Vendor/IncreasePrice/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Model\Product" shared="false">
        <plugin
                name="IncreasePrice_ProductPlugin"
                type="Vendor\IncreasePrice\Plugin\ProductPluginPrice"
                disabled="false"
                sortOrder="10" />
    </type>
</config>

app/code/Vendor/IncreasePrice/Plugin/ProductPluginPrice.php In this Plugin I'm increasing the price of the products that has the attribute set "Incrementar_Precio". It increases 35% of the price of this products.

<?php

namespace Vendor\IncreasePrice\Plugin;

use Magento\Eav\Api\AttributeSetRepositoryInterface;

class ProductPluginPrice
{
    protected $_attributeRepository;

    public function __construct(
        AttributeSetRepositoryInterface $attributeRepository
    ) {
        $this->_attributeRepository = $attributeRepository;
    }

    public function afterGetPrice(\Magento\Catalog\Model\Product $subject, $result)
    {

            $attributeSetRepository = $this->_attributeRepository->get($subject->getAttributeSetId());
        $attributeSetName = $attributeSetRepository->getAttributeSetName();

        if($attributeSetName == "Incrementar_Precio"){



            return $result+(($result*35)/100);
        } else {
            return $result;
        }

    }

}

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.