简体   繁体   中英

Remove shipping row from Woocommerce admin edit order pages

How can I hide/remove shipping row from admin order page? Please help, Thanks in advance.

点击查看截图

Maybe have a look at this? https://wordpress.org/plugins/hide-woocommerce-product-shipping-information/

It removes the shipping info from products so maybe also from the whole site.

Add this into your function file

<?php add_action( 'init', 'hide_shipping_details' );
    function hide_shipping_details() { 
        global $pagenow;
        if( is_admin() && $pagenow == "user-edit.php") { ?>
        <style> #fieldset-shipping{ display: none !important } </style>
    <?php } }

you can change css as per your requirement

To hide shipping lines and details a from admin order single pages you will use the following:

add_filter( 'woocommerce_order_get_items', 'custom_order_get_items', 10, 3 );
function custom_order_get_items( $items, $order, $types ) {
    if ( is_admin() && $types == array('shipping') ) {
        $items = array();
    }
    return $items;
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

Try this

add_action('admin_footer', 'my_custom_script');

function my_custom_script() {
  ?>
<script>
    jQuery(document).ready(function(){
      jQuery(".wc-order-totals .label:contains('Shipping')").parent().hide();
    });
</script>
<?php
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM