• Resolved fyfu

    (@fyfu)


    Hi , i want to disable buttons for status change on order quick preview (eye icon). I know 2 ways of doing that :

    .wc-order-preview footer .wc-action-button-group {
    display:none;
    }

    OR

    add_filter( 'woocommerce_admin_order_preview_actions', 'filter_admin_order_preview_actions', 10, 2 );
    function filter_admin_order_preview_actions( $actions, $order ) {
        $actions        = array();
        $status_actions = array();
        if ( $status_actions ) {
            $actions['status'] = array(
                'group'   => __( 'Change status: ', 'woocommerce' ),
                'actions' => $status_actions,
            );
        }
        return $actions;
    }

    My question is : which method is better of doing that? Just hidding with css or overriding woocommerce_admin_order_preview_actions in functions .php?

    Is that snippet above even correct way or doing that?

    Both ways are working, i am just wondering which is better/more elegant/performance wise solution.

    Greetings

Viewing 3 replies - 1 through 3 (of 3 total)
  • Saif

    (@babylon1999)

    Hello @fyfu,

    I understand you want to hide one of these elements (not sure which one you’re referring to) :


    Link to image: https://d.pr/i/HQhtRz


    Link to image: https://d.pr/i/YZbu32


    I would suggest avoiding filters, especially for layout changes as it minimizes the risk of encountering PHP errors in the future if a hook or function is deprecated/changed.

    I went ahead and wrote a few CSS lines to hide both “status” changing options in the order page, I also included comments to know which part does what.

    /* Edit WooCommerce > Orders page   */
    
    .column-wc_actions > p, #wc_actions {
    display:none;
    }
    
    .wp-list-table > thead  *:not(td) {
    	width: 100% !important;
    }
    
    /*  Remove the button from the "eye" icon  */
    
    .wc-action-button-group__items > .button{
      display: none !important;
    }

    Please add it using Simple Custom CSS and JS plugin and select the option on the right side to apply it in the admin dashboard only.

    Hope this helps!

    Hi, Thanks , This code work for me ,

    Is it poosible to remove edit button also?

    Thanks

    add_filter( 'woocommerce_admin_order_preview_actions', 'filter_admin_order_preview_actions', 10, 2 );
    function filter_admin_order_preview_actions( $actions, $order ) {
        $actions        = array();
        $status_actions = array();
        if ( $status_actions ) {
            $actions['status'] = array(
                'group'   => __( 'Change status: ', 'woocommerce' ),
                'actions' => $status_actions,
            );
        }
        return $actions;
    }

    Hi @xrayz1920

    This code work for me, Is it poosible to remove edit button also?

    Great to know that the previous code worked out for you! Now, you’re interested in removing the ‘Edit‘ button from the order preview page on your WooCommerce site, right?

    Image Link: https://snipboard.io/DxXPwi.jpg

    To make this happen, you can incorporate the following CSS into your site using the Simple Custom CSS and JS plugin:

    /* Remove the edit button from the order preview */
    .wc-order-preview footer .button.button-large {
      display: none;
    }

    This code will effectively make the edit button invisible on the order preview page. However, keep in mind that this doesn’t deactivate the button’s functionality. It simply hides it. If you want to completely disable the edit function, you might need to modify the WooCommerce plugin. This could be somewhat complex and might call for a developer’s assistance.

    ?? Just a heads up – while we’re always here to assist you, our scope of support doesn’t extend to custom development or design patterns, which includes troubleshooting or giving specific advice on using custom action hooks or filters.

    For custom solutions, our recommendation is to connect with Codeable.io, our trusted WooCommerce development partner. They’re experts in crafting custom solutions for WooCommerce and might be able to help you develop a custom solution for your problem. Check them out here: ?? https://woocommerce.com/codeable

    I hope this information is helpful. Should you have any more questions or need further help, don’t hesitate to start a ?? new topic in our support forum. This aligns with our ?? forum’s best practices, allowing us to concentrate on your specific issue. Plus, it makes things easier for other users who may also be facing the same problem.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Order quick preview buttons’ is closed to new replies.