Magento 2 delete specific product categoriesGet specific categories Name and URL to itShow Specific Categories On Magento Home PageHow to get product ids of specific category and not in other categories in Magento?How to Delete All Products Within a CategoryMagento get product current subcategory of specific parent categoryExcluding products from multiple categories in collectionI can not delete or modify a product categoryMagento 2: Display list of specific categories on Home PageHow to load only the children categories that belong to the current product (magento)Specific view for specific category in Magento 2

My employer faked my resume to acquire projects

Is "cool" appropriate or offensive to use in IMs?

Best material to absorb as much light as possible

Why did the person in charge of a principality not just declare themself king?

Defining the standard model of PA so that a space alien could understand

How can I tell if I'm being too picky as a referee?

How did NASA Langley end up with the first 737?

What is a fully qualified name?

How to deal with a colleague who is being aggressive?

Can a person survive on blood in place of water?

Website returning plaintext password

What could a self-sustaining lunar colony slowly lose that would ultimately prove fatal?

Sankey diagram: not getting the hang of it

I know that there is a preselected candidate for a position to be filled at my department. What should I do?

Is it legal to meet with potential future employers in the UK, whilst visiting from the USA

When the Torah was almost lost and one (or several) Rabbis saved it?

Access to the path 'c:somepath' is denied for MSSQL CLR

Ethical issue - how can I better document what is happening?

How to politely tell someone they did not hit "reply to all" in an email?

Count Even Digits In Number

Efficient Algorithm for the boundary of a set of tiles

Question in discrete mathematics about group permutations

Pirate democracy at its finest

What does $!# mean in Shell scripting?



Magento 2 delete specific product categories


Get specific categories Name and URL to itShow Specific Categories On Magento Home PageHow to get product ids of specific category and not in other categories in Magento?How to Delete All Products Within a CategoryMagento get product current subcategory of specific parent categoryExcluding products from multiple categories in collectionI can not delete or modify a product categoryMagento 2: Display list of specific categories on Home PageHow to load only the children categories that belong to the current product (magento)Specific view for specific category in Magento 2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















how can I delete specific categories for a product in Magento 2.Forex: I have a product with a,b,c categories, I have some conditions if the conditions meet my categories remains same but if those conditions fail I need to remove b, the category only not a,c categories. How can I achieve that?










share|improve this question
























  • Let me know whether you would like to remove programmatically? or manually

    – Nagaraju Kasa
    May 19 at 4:14











  • programmatically @NagarajuKasa

    – Prasanth
    May 19 at 4:31


















0















how can I delete specific categories for a product in Magento 2.Forex: I have a product with a,b,c categories, I have some conditions if the conditions meet my categories remains same but if those conditions fail I need to remove b, the category only not a,c categories. How can I achieve that?










share|improve this question
























  • Let me know whether you would like to remove programmatically? or manually

    – Nagaraju Kasa
    May 19 at 4:14











  • programmatically @NagarajuKasa

    – Prasanth
    May 19 at 4:31














0












0








0








how can I delete specific categories for a product in Magento 2.Forex: I have a product with a,b,c categories, I have some conditions if the conditions meet my categories remains same but if those conditions fail I need to remove b, the category only not a,c categories. How can I achieve that?










share|improve this question
















how can I delete specific categories for a product in Magento 2.Forex: I have a product with a,b,c categories, I have some conditions if the conditions meet my categories remains same but if those conditions fail I need to remove b, the category only not a,c categories. How can I achieve that?







magento2 product category delete






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 20 at 8:31









Muhammad Anas

1,0663525




1,0663525










asked May 19 at 3:46









PrasanthPrasanth

278




278












  • Let me know whether you would like to remove programmatically? or manually

    – Nagaraju Kasa
    May 19 at 4:14











  • programmatically @NagarajuKasa

    – Prasanth
    May 19 at 4:31


















  • Let me know whether you would like to remove programmatically? or manually

    – Nagaraju Kasa
    May 19 at 4:14











  • programmatically @NagarajuKasa

    – Prasanth
    May 19 at 4:31

















Let me know whether you would like to remove programmatically? or manually

– Nagaraju Kasa
May 19 at 4:14





Let me know whether you would like to remove programmatically? or manually

– Nagaraju Kasa
May 19 at 4:14













programmatically @NagarajuKasa

– Prasanth
May 19 at 4:31






programmatically @NagarajuKasa

– Prasanth
May 19 at 4:31











1 Answer
1






active

oldest

votes


















0














You need to build a category collection of the categories you want to delete.



Then it's just the case of something like this:



try 
$category->delete();
echo 'Category Removed';
catch (Exception $e)
echo 'Failed to remove category ' . $category->getId();
echo $e->getMessage();



I cant be more specific without knowing more about the conditions which means delete.






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f275146%2fmagento-2-delete-specific-product-categories%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You need to build a category collection of the categories you want to delete.



    Then it's just the case of something like this:



    try 
    $category->delete();
    echo 'Category Removed';
    catch (Exception $e)
    echo 'Failed to remove category ' . $category->getId();
    echo $e->getMessage();



    I cant be more specific without knowing more about the conditions which means delete.






    share|improve this answer



























      0














      You need to build a category collection of the categories you want to delete.



      Then it's just the case of something like this:



      try 
      $category->delete();
      echo 'Category Removed';
      catch (Exception $e)
      echo 'Failed to remove category ' . $category->getId();
      echo $e->getMessage();



      I cant be more specific without knowing more about the conditions which means delete.






      share|improve this answer

























        0












        0








        0







        You need to build a category collection of the categories you want to delete.



        Then it's just the case of something like this:



        try 
        $category->delete();
        echo 'Category Removed';
        catch (Exception $e)
        echo 'Failed to remove category ' . $category->getId();
        echo $e->getMessage();



        I cant be more specific without knowing more about the conditions which means delete.






        share|improve this answer













        You need to build a category collection of the categories you want to delete.



        Then it's just the case of something like this:



        try 
        $category->delete();
        echo 'Category Removed';
        catch (Exception $e)
        echo 'Failed to remove category ' . $category->getId();
        echo $e->getMessage();



        I cant be more specific without knowing more about the conditions which means delete.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 19 at 18:09









        Dominic XigenDominic Xigen

        54811




        54811



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f275146%2fmagento-2-delete-specific-product-categories%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?