Describe your bug or feature request.

Current code in TaxTypeForm assumes that custom tax type is always present. However, it can be removed or modified in hook_commerce_tax_type_info_alter().
Also the label is hardcoded to "Custom", so in case it is modified, it still appears as "Custom" in the form.

If a bug, provide steps to reproduce it from a clean install.

Plugin requirement:

  1. Implement hook_commerce_tax_type_info_alter() in a custom module.
  2.   function hook_commerce_tax_type_info_alter(&$definitions): void {
        unset($definitions['custom']);
      }
  3. Visit /admin/commerce/config/tax-types/add
  4. Exception is thrown

Plugin label hardcoded:

  1. Implement hook_commerce_tax_type_info_alter() in a custom module.
  2.   function hook_commerce_tax_type_info_alter(&$definitions): void {
        $definitions['custom']['label'] = 'My New Label';
      }
  3. Visit /admin/commerce/config/tax-types/add
  4. 'Custom' is shown as label instead of 'My New Label'

Issue fork commerce-3294242

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plopesc created an issue. See original summary.

plopesc’s picture

Status: Active » Needs review

MR created, trying to tackle the 2 issues mentioned above.

It also extracts the logic to generate the list of plugins to its specific method to improve the DX in case of willing to customize the list behavior.

Thank you!

plopesc’s picture

Title: TaxtypeForm assumes that custom plugin is always present » TaxTypeForm assumes that custom plugin is always present
Issue summary: View changes

  • jsacksick committed 39ddcde on 8.x-2.x authored by plopesc
    Issue #3294242 by plopesc, jsacksick: TaxTypeForm assumes that custom...
jsacksick’s picture

Status: Needs review » Fixed

Renamed the method and committed, thanks!

  • jsacksick committed 6954cc8 on 3.0.x authored by plopesc
    Issue #3294242 by plopesc, jsacksick: TaxTypeForm assumes that custom...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.