• is there a way to create packages then only allow free shipping for one package if it is over 25 dollars just for that package.?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Bolder Elements

    (@hystericallyme)

    Sure, this plugin only separates the items into different packages based on shipping class. Your shipping method determines the price and with the right shipping method you can setup a rule like “Free Shipping for Class A when its subtotal is over $25”.

    The Flat Rate method that comes with WooCommerce allows you to set a flat price for a shipping class, but a Table Rate method like ours allows you to set the fee and additional conditions as well:

    https://1.envato.market/bK01g

    Thread Starter Dakid

    (@myiah)

    So can the Multiple Packages for WooCommerce do what i want it to do?

    Thread Starter Dakid

    (@myiah)

    Im confused i install the plugin. It did what i thought it will do it broke the order into packages based on shipping class which is wonderful.

    It also takes the shipping method specified within the plugin which is great.

    But i need a tweak maybe a custom code snippet or something.

    I need it to take the subtotal of just one package not the whole order and check to see if its above 25 or not if it is then apply free shipping.

    as of now it is take the whole order amount I just need it to take the subtotal of the 1 package.

    Can it do that? it is almost working like i want it too.
    Please let me know if i can insert custom code or something to fix this.

    Plugin Author Bolder Elements

    (@hystericallyme)

    It will still depend on the shipping method, but I would have thought the Free Shipping method that comes with WooCommerce would be coded correctly to look at the package subtotal. Is that the one you are using?

    Thread Starter Dakid

    (@myiah)

    Yes,

    but it doesn’t calculate the subtotal as a whole it just calculates the subtotal as an whole.

    Thread Starter Dakid

    (@myiah)

    I have something working now. I wrote it and hooked it into the functions.php file. Let me know if I can contribute to your plugin for future updates.

    Plugin Author Bolder Elements

    (@hystericallyme)

    I’m not sure I understand what you are saying. Your second to last message did not make sense to me. A typo perhaps? I’ve reviewed the code to make sure there is not a problem, but it correctly moves the costs for the items into their groups, so there’s no reason the subtotal should be more than the amount of the items in just the package.

    What did you modify?

    Thread Starter Dakid

    (@myiah)

    i guess what i am asking is i only want it the threads to be package if it is over the 25.00 and if it is then to apply free shipping. if not then to include those items in the regular items. right now using you plugin it separates them and puts and applies the flat rate to both packages. i also wrote some code to try to achieve this you can find below but the problem with the code is that it doesnt include the threads items in the cart shipping total if the package sub total is below 25.00

    Please take a look

    function threads_woocommerce_cart_shipping_packages( $packages ) {
        // Reset the packages
        $packages = array();
      
        // threads items
        $threads_items = array();
        $regular_items = array();
        
        // Sort threads from regular
        foreach ( WC()->cart->get_cart() as $item ) {
            if ( $item['data']->needs_shipping() ) {
                if ( $item['data']->get_shipping_class() == 'threads' ) {
                    $threads_items[] = $item;
                } else {
                    $regular_items[] = $item;
                }
            }
        }
        
       
    
          $threads_shipping   = array_sum( wp_list_pluck( $threads_items, 'line_total' ) );
    
    if(($threads_shipping) > 24.99) {
    	  
    	
    		
    		   $packages[] = array(
    		    'ship_via' => array( 'free_shipping' ),
    
    		             
    		    'contents' => $threads_items,
                'contents_cost' => array_sum( wp_list_pluck( $threads_items, 'line_total' ) ),
                'applied_coupons' => WC()->cart->applied_coupons,
                'destination' => array(
                    'country' => WC()->customer->get_shipping_country(),
                    'state' => WC()->customer->get_shipping_state(),
                    'postcode' => WC()->customer->get_shipping_postcode(),
                    'city' => WC()->customer->get_shipping_city(),
                    'address' => WC()->customer->get_shipping_address(),
                    'address_2' => WC()->customer->get_shipping_address_2()
    			  
    			  
    			  
                )
    
            );
    		
            } else {
    		
    
    		 if ( empty( $packages[0]['contents'] ) ) {
                    unset( $packages[0] );
                }
    		
    	  }
      
      
      
        if ( $regular_items ) {
            $packages[] = array(
    		  	'ship_via' => array( 'flat_rate' ),
    		  	
                'contents' => $regular_items,
                'contents_cost' => array_sum( wp_list_pluck( $regular_items, 'line_total' ) ),
                'applied_coupons' => WC()->cart->applied_coupons,
                'destination' => array(
                    'country' => WC()->customer->get_shipping_country(),
                    'state' => WC()->customer->get_shipping_state(),
                    'postcode' => WC()->customer->get_shipping_postcode(),
                    'city' => WC()->customer->get_shipping_city(),
                    'address' => WC()->customer->get_shipping_address(),
                    'address_2' => WC()->customer->get_shipping_address_2()
                )
            );
    
            
        }    
        
        return $packages;
      
      
    }
    
      // End of If statement for the whole threads category for free shipping
    
    add_filter( 'woocommerce_cart_shipping_packages', 'threads_woocommerce_cart_shipping_packages' );
    
    
    Plugin Author Bolder Elements

    (@hystericallyme)

    I still think you are more in need of an advanced shipping method than this plugin. The purpose of this plugin is to divide the items in the cart into groups so that their shipping costs are displayed separately. This is helpful for items sold from different vendors with different shipping rules and different options, or items coming from different warehouses that might have different delivery times. Generally speaking, this plugin does not change or affect the final shipping cost. It simply breaks it down so that the customer knows how much of that cost is for each item in their cart.

    For example, if the customer buys Item A and Item B, the shipping cost would normally show a combined total of 12.98. With this plugin, you could instead show 8.99 shipping for Item A, and 3.99 shipping for Item B.

    Thread Starter Dakid

    (@myiah)

    Even if the cost specificied for shipping is

    XXX + 1.00 *[qty]

    will it still do that becasue im not showing that it does?

    it adds them up both seperate?

    Thread Starter Dakid

    (@myiah)

    Is there a way through your plugin to look at the items in the cart and apply free shipping to the class?

    like a code snippet or something i can put into the functions.php file

    Thread Starter Dakid

    (@myiah)

    I hope so

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Free Shipping Packages’ is closed to new replies.