Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Content]: New address validation requirements in Commerce 4 #504

Open
lukeholder opened this issue May 23, 2023 · 1 comment
Open

[Content]: New address validation requirements in Commerce 4 #504

lukeholder opened this issue May 23, 2023 · 1 comment

Comments

@lukeholder
Copy link
Member

lukeholder commented May 23, 2023

Product

Commerce 4

Description

Since addresses are now validated with the used/required data from the addressing/google library, we should add an example of removing a required field that was not required previously:

Event::on(
    Address::class,
    Model::EVENT_DEFINE_RULES,
    function(DefineRulesEvent $event) {
        $event->rules = array_filter(
            $event->rules,
            function($rule) {
                return $rule[0] !== ['administrativeArea'] && $rule[1] !== 'required';
            }
        );
    }
);

Possibly to: https://craftcms.com/docs/commerce/4.x/upgrading.html#address-management

@lukeholder
Copy link
Member Author

lukeholder commented May 23, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant