Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the simple-custom-post-order domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/staging.wpify.io/web/wp/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the woocommerce domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/staging.wpify.io/web/wp/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the woocommerce-subscriptions domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/staging.wpify.io/web/wp/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpify-woo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/staging.wpify.io/web/wp/wp-includes/functions.php on line 6114
Upravení dat dokumentů – WPify

Dokumentace

Upravení dat dokumentů

Pokud potřebujete upravit data odesílaná do Fakturaidu za účelem vytvoření dokumentu můžete k tomu využít připravený filtr:

apply_filters( 'wpify_woo_fakturoid_invoice_data', $data, $order, $wc_order );

Aktuálně odesílaná data jsou

$data = array(
  'subject_id'        // id kontaktu z Fakturoidu
  'payment_method'    // platební metoda z Fakturoidu
  'order_number'      // číslo objednávky
  'vat_price_mode'    // cenový režim DPH: without_vat, from_total_with_vat
  'currency' 	      // měna
  'subject_custom_id' // id přihlášeného uživatele
  'number_format_id'  // id číselné řady
  'variable_symbol'   // variabilní symbol
  'proforma'          // je-li proforma hodnota je true
  'note'	          // poznámka např u opravných dokladů
  'correction'	      // je-li opravný doklad hodnota je true
  'correction_id'     // id opravovaného dokladu
);

$data['lines'] = array( // data jednotlivých položek
  'name'       // název produktu
  'quantity'   // množství
  'unit_price' // cena za jednotku
  'vat_rate'   // hodnota DPH
);

Příklad vlastní funkce pro úpravu dat v které se přidávají jednotky pro množství u produktů

/**
 * Edit Fakturoid document data
 * 
 * @param array                               $data     Data
 * @param WpifyWooFakturoid\Models\OrderModel $order    Order model with Fakturoid data
 * @param WC_Order                            $wc_order WC order
 *
 * @return array
 */
function edit_fakturoid_invoice_data( $data, $order, $wc_order ): array {
	foreach ( $data['lines'] as $key => $line ) {
        $data['lines'][ $key ]['unit_name'] = 'ks';
    }

	return $data;
}
add_action( 'wpify_woo_fakturoid_invoice_data', 'edit_fakturoid_invoice_data', 10, 3 );

[basepress-notice style=“info“]Vlastní funkce můžete vložit buď do tzv. child šablony nebo pomocí pluginu Code Snippets[/basepress-notice]