Jump to content

How to delete a product attribute programmatically?


Recommended Posts

Hello, I have been able to delete product attribute groups this way:

if($_GET['id']){
    $id = $_GET['id'];
    $attribute_group = new AttributeGroup($id);
    $attribute_group->delete();
    echo "deleted";
}

I want to know how to delete a product attribute, I have tried this but this is not working:

if ($_GET['id_ag']){
  $id_ag = $_GET['id_ag'];
  $name  = $_GET['name'];
  $attribute = new Attribute($id_ag,$name);
  $attribute -> delete();
  echo "deleted";
}

What is the right way to delete a product attribute programmatically?

 

Help will be greatly appreciated!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...