Skip to content
Snippets Groups Projects

Fakturownia - dodaje Adres wysyłki do sekcji Odbiorca na fakturze

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Krzysztof Dyszczyk
    Fakturownia - dodaje Adres wysyłki do sekcji Odbiorca na fakturze.php 1.45 KiB
    add_filter( 'fakturownia/invoice/data', 'wpdesk_fakturownia_shipping_client_data', 10, 2 );
    function wpdesk_fakturownia_shipping_client_data( array $data, WPDesk\WooCommerceFakturownia\Data\DocumentData $document_data ) {
    	if ( $document_data->getOrder()->get_shipping_address_1() !== $document_data->getOrder()->get_billing_address_1() ) {
    		$shipping_address1   = $document_data->getOrder()->get_shipping_address_1();
    		$shipping_address2   = $document_data->getOrder()->get_shipping_address_2();
    		$shipping_company    = $document_data->getOrder()->get_shipping_company();
    		$shipping_country    = $document_data->getOrder()->get_shipping_country();
    		$shipping_first_name = $document_data->getOrder()->get_shipping_first_name();
    		$shipping_last_name  = $document_data->getOrder()->get_shipping_last_name();
    		$shipping_city       = $document_data->getOrder()->get_shipping_city();
    		$shipping_postcode   = $document_data->getOrder()->get_shipping_postcode();
    		$shipping_phone      = '';
    		$shipping_email      = '';
    
    		$data['recipient_name']      = $shipping_company . ' ' . $shipping_first_name . ' ' . $shipping_last_name;
    		$data['recipient_street']    = $shipping_address1 . '' . $shipping_address2;
    		$data['recipient_post_code'] = $shipping_postcode;
    		$data['recipient_city']      = $shipping_city;
    		$data['recipient_country']   = $shipping_country;
    		$data['recipient_email']     = $shipping_email;
    		$data['recipient_phone']     = $shipping_phone;
    	}
    
    	return $data;
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment