Delivery Charge on Specific Items

WPPizza – A Restaurant Plugin for WordPress Support General Support Delivery Charge on Specific Items

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #37153
    sage
    Participant

      On the settings page there is a check box for adding delivery charges on all items when delivery is chosen.

      But I have some items that I do not want to add a delivery charge such as beverages.

      Can each menu item specify whether a delivery charge will be applied or not?

      Thank you

      #37164
      Olly
      Admin & Mod

        >On the settings page
        I assume you are referring to the *order* settings page

        >Can each menu item specify whether a delivery charge will be applied or not?
        not natively in the plugin, however, there is the following filter you could use to substract the delivery charge if a particular item (let’s say with id 5) is in the cart
        I also assume you are using “Delivery Charges per item” in the settings here

        So, something like this (not tested, mileage will vary, but should give you an idea):

        
        add_filter('wppizza_fltr_delivery_charges', 'my_prefix_delivery_charges_filter', 10, 3);
        function my_prefix_delivery_charges_filter($delivery_charges, $cart_items, $general_parameters){
        global $wppizza_options;
        /* current set delivery charges per item */
        $dcpi = $wppizza_options['order_settings']['delivery_charge_per_item'];
        $reduce_delivery_charges = 0;
        foreach($cart_items as $items){
        foreach($items as $item){
        if($item['post_id'] == 5 ){
        $reduce_delivery_charges += $dcpi;	
        }
        }
        }
        /* substract */
        $delivery_charges = $delivery_charges-$reduce_delivery_charges;
        return $delivery_charges;	
        }
        
      Viewing 2 posts - 1 through 2 (of 2 total)
      • The topic ‘Delivery Charge on Specific Items’ is closed to new replies.