---
title: "How to Enable/Disable Ship Button Based on Order Status in Magento 2?"
url: "https://magecomp.com/blog/enable-disable-ship-button-based-on-order-status-magento-2/"
date: "2025-08-25T09:53:53+00:00"
modified: "2025-08-25T09:56:45+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 600
reading_time: "3 min read"
summary: "Hello Magento Friends,"
description: "Learn how to enable or disable the Ship button in Magento 2 based on order status. Prevent shipping errors, streamline order management, and ensure shipments..."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to add Custom CSS Stylesheet using the block in Magento 2?"
    url: "https://magecomp.com/blog/add-custom-css-stylesheet-using-block-magento-2/"
  - title: "Exclusive List of Best Magento SEO Plugins in 2026"
    url: "https://magecomp.com/blog/best-magento-seo-plugins/"
  - title: "Magento 2: How to Change Default Sort Order from Ascending to Descending for Product Listing in Category Page?"
    url: "https://magecomp.com/blog/magento-2-change-default-sort-order-from-ascending-to-descending-for-product-listing-in-category-page/"
---

# How to Enable/Disable Ship Button Based on Order Status in Magento 2?

_Published: August 25, 2025_  
_Author: Dhiren Vasoya_  

![How to Enable Disable Ship Button Based on Order Status in Magento 2](https://magecomp.com/blog/wp-content/uploads/2025/08/How-to-Enable-Disable-Ship-Button-Based-on-Order-Status-in-Magento-2-1-1024x672.webp)

**Hello Magento Friends,**

In Magento 2, managing order statuses is key to streamlining order fulfillment. By default, Magento provides the ability to create shipments to orders, but sometimes you want to either restrict or allow the Ship button only to selected order statuses.

For example:

- You may want to remove the Ship button when an order is “Pending Payment” or “Canceled.”
- You may want it to be enabled only for Paid or Processing orders.

In this tutorial, we’ll show you how to enable/disable the Ship button in Magento 2 depending on the order status.

[![Hire Magento Programmer](https://magecomp.com/blog/wp-content/uploads/2025/02/Hire-Magento-Programmer-CTA-2.webp)](https://magecomp.com/services/hire-magento-programmer/)

## Why Control the Ship Button in Magento 2?
Controlling the availability of the Ship button is important for merchants.

- Reduces the chances of mistakes such as shipping out unpaid or canceled orders.
- Simplifies workflows by shipping only when necessary.
- Improves customer experience by removing errors in order processing.

By default, the ship button will be visible as soon as the order gets placed.

![](https://magecomp.com/blog/wp-content/uploads/2025/08/before-1024x487.webp)

## Steps to Disable Ship Button Based on Order Status in Magento 2:
**Step 1:** Create a **di.xml** file at the given path

**app/code/Vendor/Extension/etc/adminhtml/di.xml**

Now add the code as follows:

```
<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoBackendBlockWidgetContext">
        <plugin name="remove_button_from_sales_veiw" type="VendorExtensionPluginWidgetContext" sortOrder="1"/>
    </type>
</config>
```

**Step 2:** Create a **Context.php** file at the given path

**app/code/Vendor/Extension/Plugin/Widget/Context.php**

Now add the code as follows:

```
<?php

namespace VendorExtensionPluginWidget;

use MagentoFrameworkRegistry;

class Context
{
    /**
     * @var Registry
     */
    private $registry;

    /**
     * Context constructor.
     *
     * @param Registry $registry
     */
    public function __construct(
        Registry $registry
    ) {
        $this->registry = $registry;
    }

    /**
     * @param MagentoBackendBlockWidgetContext $subject
     * @param MagentoBackendBlockWidgetButtonButtonList $buttonList
     * @return mixed
     */
    public function afterGetButtonList(
        MagentoBackendBlockWidgetContext $subject,
        $buttonList
    ) {
        if ($subject->getRequest()->getFullActionName() == 'sales_order_view') {
            if ($this->getOrder() && ($this->getOrder()->getStatus() == 'pending')) {
                $buttonList->remove('order_ship');
            }
        }

        return $buttonList;
    }

    /**
     * Retrieve order model object
     *
     * @return MagentoSalesModelOrder
     */
    private function getOrder()
    {
        return $this->registry->registry('sales_order');
    }
}
```

Replace the following condition with your condition:

```
if ($this->getOrder() && ($this->getOrder()->getStatus() == 'pending'))
```

**Output:**

Using the above code, the ship button will be disabled.

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXf2R4MVcDaGSUJXFyYV6_p5Sm_WqNSX5-hriEbxOpvEYBzOox02LXjrK3PDUR_5O77eeZ_5Oktg0n1B47m8D199PplKRXN7S2nCfHsiLwECDl80uYqfhjSI4bAH5baUEuO56TxpsQ?key=9u1hiSqxKST1TaK2WbASWQ)

## Conclusion:
Controlling the Ship button in Magento 2 will also ensure that only eligible orders can ship out, which will help store admins avoid errors and have a much smoother workflow. With only a small customization, you can enable or disable the Ship button based on the order status and optimize your order fulfillment process.

**Happy Coding!**

[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-3.webp)](https://magecomp.com/services/magento-upgrade-services/)

## FAQ
1. **What is the Ship button in Magento 2?**

The Ship button in Magento 2 provides a means for store admins to create a shipment for an order, and is typically available whenever an order is ready to ship.

2. **Why would I want to disable the Ship button?**

You would want to disable it as a way to help prevent errors like shipping canceled, unpaid, or on-hold orders. Disabling the Ship button would essentially help you only ship valid orders.

3. **Can I choose which order statuses allow shipping?**

Yes. You can configure order statuses in Magento 2 to only enable the Ship button for a specified status, like “Processing” or “Complete”, and disable allowed order statuses like “Pending Payment” or “Canceled”.

4. **Will disabling the Ship button affect my customers?**

No. Disabling the Ship button will only affect the Magento 2 admin panel. Customers will see no difference on the front edge of your store.


---

_View the original post at: [https://magecomp.com/blog/enable-disable-ship-button-based-on-order-status-magento-2/](https://magecomp.com/blog/enable-disable-ship-button-based-on-order-status-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-10-09 07:18:29 UTC_  
