I am trying to setup the Sales tax in Drupal Commerce 8.x.2.16 (Drupal Core 8.8.1). I remember that previously when the United State is selected in the Territory list, a selection list of States will show up. It does not seem to work now. Has the behavior been changed? How do I setup the state sales tax, specifically for California? Through using the Zip Codes? Appreciate any comments and suggestions.

Comments

Bao Ha created an issue. See original summary.

czigor’s picture

I can confirm the bug exists using the latest commerce and address dev. Might also be an address bug.

czigor’s picture

Project: Commerce Core » Address
Version: 8.x-2.16 » 8.x-1.x-dev
Component: Tax » Code
Status: Active » Needs review
StatusFileSize
new2.86 KB
new3.45 KB

This seems to be a regression from https://git.drupalcode.org/project/address/commit/d78ba8f from June. It's weird that it's been noticed only now.

czigor’s picture

StatusFileSize
new3.37 KB

Fixing some code comments.

czigor’s picture

StatusFileSize
new3.44 KB
new2.85 KB
new465 bytes

Fix tests.

Bao Ha’s picture

It works after I applied the patches in the "address-3105484-zone_bug-5.patch" file. The dropped down list of states shows up again when United States is selected as the territory. Thank you!

bojanz’s picture

Title: Cannot create specific US State in Custom Tax » Broken #ajax in ZoneTerritory
Priority: Normal » Major

Better title.

  • bojanz committed cde1f24 on 8.x-1.x authored by czigor
    Issue #3105484 by czigor, bojanz: Broken #ajax in ZoneTerritory
    
bojanz’s picture

Status: Needs review » Fixed

Expanded the test and committed. Thanks, czigor!

playful’s picture

I updated to the latest version of address (8.x-1.8) yesterday and am now having this problem. Several countries such as United States and Mexico don't load state or city fields when selected and produce the below error. The same error occurs when trying to edit any previously created nodes for which the address field country was set to United States, Mexico, etc.

Error: Undefined class constant 'CANTON' in Drupal\address\LabelHelper::getAdministrativeAreaLabels() (line 105 of /home/mydir/webapps/mysite/modules/contrib/address/src/LabelHelper.php)
#0 /home/mydir/webapps/mysite/modules/contrib/address/src/LabelHelper.php(91): Drupal\address\LabelHelper::getAdministrativeAreaLabels()
#1 /home/mydir/webapps/mysite/modules/contrib/address/src/LabelHelper.php(73): Drupal\address\LabelHelper::getAdministrativeAreaLabel('state')
#2 /home/mydir/webapps/mysite/modules/contrib/address/src/Element/Address.php(234): Drupal\address\LabelHelper::getFieldLabels(Object(CommerceGuys\Addressing\AddressFormat\AddressFormat))
#3 /home/mydir/webapps/mysite/modules/contrib/address/src/Element/Address.php(202): Drupal\address\Element\Address::addressElements(Array, Array)
#4 [internal function]: Drupal\address\Element\Address::processAddress(Array, Object(Drupal\Core\Form\FormState), Array)
#5 /home/mydir/webapps/mysite/core/lib/Drupal/Core/Form/FormBuilder.php(999): call_user_func_array(Array, Array)
#6 /home/mydir/webapps/mysite/core/lib/Drupal/Core/Form/FormBuilder.php(1062): Drupal\Core\Form\FormBuilder->doBuildForm('node_job_form', Array, Object(Drupal\Core\Form\FormState))
#7 /home/mydir/webapps/mysite/core/lib/Drupal/Core/Form/FormBuilder.php(1062): Drupal\Core\Form\FormBuilder->doBuildForm('node_job_form', Array, Object(Drupal\Core\Form\FormState))
#8 /home/mydir/webapps/mysite/core/lib/Drupal/Core/Form/FormBuilder.php(1062): Drupal\Core\Form\FormBuilder->doBuildForm('node_job_form', Array, Object(Drupal\Core\Form\FormState))
#9 /home/mydir/webapps/mysite/core/lib/Drupal/Core/Form/FormBuilder.php(1062): Drupal\Core\Form\FormBuilder->doBuildForm('node_job_form', Array, Object(Drupal\Core\Form\FormState))
#10 /home/mydir/webapps/mysite/core/lib/Drupal/Core/Form/FormBuilder.php(563): Drupal\Core\Form\FormBuilder->doBuildForm('node_job_form', Array, Object(Drupal\Core\Form\FormState))
#11 /home/mydir/webapps/mysite/core/lib/Drupal/Core/Form/FormBuilder.php(320): Drupal\Core\Form\FormBuilder->processForm('node_job_form', Array, Object(Drupal\Core\Form\FormState))
#12 /home/mydir/webapps/mysite/core/lib/Drupal/Core/Controller/FormController.php(91): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\node\NodeForm), Object(Drupal\Core\Form\FormState))
#13 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#14 /home/mydir/webapps/mysite/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#15 /home/mydir/webapps/mysite/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#16 /home/mydir/webapps/mysite/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#17 /home/mydir/webapps/mysite/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#18 /home/mydir/webapps/mysite/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /home/mydir/webapps/mysite/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#20 /home/mydir/webapps/mysite/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /home/mydir/webapps/mysite/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /home/mydir/webapps/mysite/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /home/mydir/webapps/mysite/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /home/mydir/webapps/mysite/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /home/mydir/webapps/mysite/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /home/mydir/webapps/mysite/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /home/mydir/webapps/mysite/core/lib/Drupal/Core/DrupalKernel.php(694): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /home/mydir/webapps/mysite/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#29 {main}

The only other patch I have applied is this one: https://www.drupal.org/project/address/issues/2857593

bojanz’s picture

@playful
That's not caused by this issue. You didn't update Address properly so now your module and library are out of sync (library is behind the module). You need to use composer update --with-dependencies

playful’s picture

Silly me... thank you, bojanz!

Status: Fixed » Closed (fixed)

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