Magento – Create Account not working properly for Guest User : Delete operation is forbidden for current area (Enterprise Magento ver. 2.1.0)

checkouterrormagento-2.1magento-enterprisemagento2

Error:

Delete operation is forbidden for current area

Steps to reproduce :

  1. Create an address attribute from stores >> Attribute >> Customer address.

  2. Set the attribute input type as Text Field

  3. Set show in Front-end and show in Customer Address Registration and Customer Account Address forms.

  4. Set values required field 'Yes'

  5. The new text field will show up in forms.

  6. Add any products to cart >> Checkout with Guest >> Fill data into newly created attributes >> Place Order >> Click on 'Create Account link'

  7. Then error message receiving 'Delete operation is forbidden for current area'.

Expected result

Notification message should be display for create account.

Actual result

Delete operation is forbidden for current area

enter image description here
enter image description here

Best Answer

You can use following code for Delete operation is forbidden for current area in products or any un secured area // Here is for product delete

$registry = $objectManager->get('\Magento\Framework\Registry');
$registry->register('isSecureArea', true);
$removeproduct = $objectManager->create('\Magento\Catalog\Model\Product');
$removeproduct->load(21); / Product id
$removeproduct->delete();

Its working for me

Related Topic