0

I have the problem that for a custom new product type there are no taxes getting calculated and are always 0.

I found a solution here. It says there is a dropdown in the product details called Tax Class:

enter image description here

But there is no such field for me (on any product type). The attribute set is set to default.

enter image description here

Attribute Set "Default":

enter image description here

As you can see an attribute with name "tax_class_id" already exist in this attribute set, but why is it not showing?

2
  • Hi Black, usually the 'tax_class_id' is inside the advanced_pricing options. I don't know if your custom product has that. But just in case... – PauGNU Dec 3 '20 at 11:31
  • It does not have it. Thx for the info. – Black Dec 3 '20 at 11:38
0

If you just create a new Product Type, admin product form does not contain some standard fields like Price and Tax Class. You need to associate this standard common attributes with your new Product Type via InstallData/UpgradeData scripts. Example:

$productEntityTypeId = $eavSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
$fieldsCommon = [ // list of fields you need
    'tax_class_id'
];
foreach ($fieldsCommon as $field) {
    $applyTo = explode(
        ',',
        $eavSetup->getAttribute($productEntityTypeId, $field, 'apply_to')
    );
    if (!in_array('<new-type-code>', $applyTo)) {
        $applyTo[] = '<new-type-code>';
        $eavSetup->updateAttribute(
            $productEntityTypeId,
            $field,
            'apply_to',
            implode(',', $applyTo)
        );
    }
}
0

I have faced the same issue so you need to change the catalog_eav_attribute table so connect step connect PHPMyAdmin and follow the below step given :

Step 1: Select the database are you using and run the below command

SELECT * FROM eav_attribute WHERE attribute_code LIKE '%tax_class_id%'

enter image description here

Step 2: run the below query

SELECT * FROM catalog_eav_attribute WHERE attribute_id = 136

enter image description here

Step 3 : change the value of apply_to filed like "simple,virtual,downloadable,configurable,bundle"

enter image description here

I am 100% sure your issue resolve after apply the above solution.

Happy coding....

reference link -> Magento 2: 'Tax Class' is not showing in products from admin panel

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.