• Resolved isoosi

    (@isoosi)


    I have the pro / premium version of your plugin, but when we do exports the shipping fields are blank. We are using the WooCommerce multiples shipping addresses plugin.

    How do we get the orders to export with each shipping addresses package separated out?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author algol.plus

    (@algolplus)

    Thread Starter isoosi

    (@isoosi)

    Plugin Author algol.plus

    (@algolplus)

    hi

    Could you submit ticket here and attach this plugin as .zip file ?

    thanks, Alex

    Thread Starter isoosi

    (@isoosi)

    I just sent it just now

    Plugin Author algol.plus

    (@algolplus)

    this code adds shipping information for each product

    class WOE_add_product_shipping{
    	var $items_shipping;
    	
    	function __construct() {
    		add_filter('woe_get_order_product_fields', array($this,'add_shipping_fields'), 10, 2);
    		add_filter('woe_order_export_started',array($this,'fetch_product_shipping'), 10, 1);
    		add_filter('woe_fetch_order_product',array($this,'fill_product_shipping'), 10, 5);
    	}	
    	
    	function add_shipping_fields($fields,$format) {
    		$names = array('first_name','last_name','company','country','address_1','address_2','city','state','postcode');
    		foreach($names as $f) {
    			$fields['shipping_'.$f] = array('label'=>"Product Shipping ".$f,'checked' => 1, 'colname'=>"Product Shipping ".$f);
    		}	
    		return $fields;
    	}
    	
    	function fetch_product_shipping($order_id) {
    		//reset values
    		$this->items_shipping = array();
    		
    		$shipping_packages = get_post_meta($order_id, '_wcms_packages', true );
    		foreach($shipping_packages  as $pack) {
    			$addr = $pack['destination'];
    			foreach($pack["contents"] as $item) {
    				$key = $item['product_id']."-".$item['variation_id'];
    				$this->items_shipping[$key] = $addr;
    			}
    		}
            return $order_id;
    	}
    	
    	function fill_product_shipping($row, $order, $item, $product, $item_meta) { 
    		$key = $item['product_id']."-".$item['variation_id'];
    		if( isset($this->items_shipping[$key]) ) {
    			foreach($this->items_shipping[$key] as $k=>$v) {
    				$k = 'shipping_'.$k;
    				if( isset($row[$k]) )
    					$row[$k] = $v; 
    			}
    		}
    		return $row;
    	}
    }	
    new WOE_add_product_shipping();
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Multiple Addresses’ is closed to new replies.