• Resolved mom4i911024

    (@mom4i911024)


    Hi there,

    I’m looking for an efficient way to disable certain shipping properties added by Germanized to the WooCommerce orders REST API. Here’s a screenshot of the fields in question.

    One of my clients reported that their ERP system is receiving an error due to these fields and has asked us to disable them. I’ve noticed that the fields disappear when I deactivate Germanized, but we still want to use the plugin without accidentally breaking something by manually excluding them.

    I’ve tried disabling all shipping settings and using a filter as shown here, but the fields are still present.

    I would appreciate any suggestions or help on how to achieve this.

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author vendidero

    (@vendidero)

    Hi there,

    You could remove the filter added by Germanized to attach the data to the API with a remove_filter call. See: https://github.com/vendidero/woocommerce-germanized-shipments/blob/master/src/Api.php#L20

    Best

    Thread Starter mom4i911024

    (@mom4i911024)

    Thank you! I guess you meant I should remove all three of them or? Seems like the actual fields disappear by removing prepare_order_shipments function in particular. I’ve used this which seems to do the trick:

    add_action( 'wp_loaded', 'germanized_remove_shipment_filters', 1000 );
    
    function germanized_remove_shipment_filters() {
        // Ensure the class and method exist before attempting to remove the filters.
        if ( class_exists( 'Vendidero\Germanized\Shipments\Api' ) ) {
            remove_filter( 'woocommerce_rest_shop_order_schema', array( 'Vendidero\Germanized\Shipments\Api', 'order_shipments_schema' ), 10 );
            remove_filter( 'woocommerce_rest_prepare_shop_order_object', array( 'Vendidero\Germanized\Shipments\Api', 'prepare_order_shipments' ), 15 );
            remove_filter( 'woocommerce_rest_pre_insert_shop_order_object', array( 'Vendidero\Germanized\Shipments\Api', 'insert_order_shipments' ), 10 );
        }
    }
    Plugin Author vendidero

    (@vendidero)

    Yes, all three of them ?? Glad that it works!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable WooCommerce Orders REST API Shipping Properties’ is closed to new replies.