Skip to content

Newsletter enabled setting is always retrieved from the default scope #31188

Closed
@savimar06

Description

@savimar06

When disabling the newsletter for store scope and website scope the newsletter checkbox is still visible in register form and the newsletter info-box is visible in customer account dashboard.

The newsletter enabled setting is always retrieved from the default scope

Preconditions (*)

  1. Magento Version: 2.3.5-p2

Steps to reproduce (*)

  1. Enable the newsletter for default scope in Stores > Settings > Configuration -> Customers -> Newsletter > General Options > Enabled
  2. Disable newsletter for store scope.
  3. Navigate to customer registration page

Expected result (*)

  1. the newsletter should be disabled in frontend. The newsletter subscription checkbox should not be visible in register form and the newsletter info-box should not be visible in customer account dashboard

Actual result (*)

  1. The newsletter subscription checkbox is visible in register form and the newsletter info-box is visible in customer account dashboard
    Kuvakaappaus - 2020-12-07 13-50-58
    Kuvakaappaus - 2020-12-07 13-49-55

\Magento\Newsletter\Model\Config::isActive

    /**
     * Returns newsletter's enabled status
     *
     * @param string $scopeType
     * @return bool
     */
    public function isActive(string $scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT): bool
    {
        return $this->scopeConfig->isSetFlag(self::XML_PATH_NEWSLETTER_ACTIVE, $scopeType);
    }

\Magento\Customer\Block\Form\Register::isNewsletterEnabled

    /**
     * Newsletter module availability
     *
     * @return bool
     */
    public function isNewsletterEnabled()
    {
        return $this->_moduleManager->isOutputEnabled('Magento_Newsletter')
            && $this->newsLetterConfig->isActive();
    }

Metadata

Metadata

Assignees

Labels

Component: NewsletterIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: ready for confirmationPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions