3

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

1
  • 1
    Hello Abhishek, Can you solve it Man?
    – Moin Malek
    Commented Feb 21, 2017 at 12:14

2 Answers 2

0

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

-1

This error can be realted to PHP compatibility :

  • For Magento 2.3 : PHP 7.1

  • For Magento 2.2 : PHP 7.1 or PHP 7.0

  • For Magento 2.1 : PHP 7.1, PHP 7.0 or PHP 5.6

  • For Magento 2.0 : PHP 7.0, PHP 5.6 or PHP 5.5

Check your PHP version, and upgrade or downgrade PHP if needed.

You will never make Magento 2 works fine without the good version of PHP

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.