Support » Plugin: WooCommerce » Shipping Charges according Order

  • Resolved Supriya_Kadam


    I am using WooCommerce 2.0.20 it works fine. How to check order contain different category products or not ? because states are my product categories and if customer order have different category product then he/she pay more as a shipping charges. for e.g. if my product categories are ‘abc’,’pqr’ and customer order 1 product from ‘abc’ and another from ‘pqr’ then he/she pay extra X amount as shipping charge. If order all product from either ‘abc’ or ‘pqr’ then he/she not pay extra amount. Please help me to solve my problem ….

Viewing 1 replies (of 1 total)
  • Finally i got answer…

    If you add different shipping charges according to product category then you need to create shipping classes. Add those shipping classes with amount in additional rate which in Woocommerce->Shipping -> Flat Shipping
    And according to your condition you can hide or show shipping classes.
    To hide or show shipping class you can write code in your theme function.php Also you show only one method which satisfy your condition.

    e.g. If i want to hide other shipping method when shipping method are available then code become

    // Hide standard shipping option when free shipping is available
    add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 );
     *  Hide Standard Shipping option when free shipping is available
     * @param array $available_methods
    function hide_standard_shipping_when_free_is_available( $available_methods ) {
        if( isset( $available_methods['free_shipping'] ) AND isset( $available_methods['flat_rate'] ) ) {
            // remove standard shipping option
            unset( $available_methods['flat_rate'] );
        return $available_methods;
Viewing 1 replies (of 1 total)
  • The topic ‘Shipping Charges according Order’ is closed to new replies.