Last active
December 31, 2023 11:53
-
-
Save webdados/830370772757a40062ee28565c81df64 to your computer and use it in GitHub Desktop.
Manipulate item data before adding it to a InvoiceXpress document on the "Invoicing with InvoiceXpress for WooCommerce – Pro" plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Change item properties | |
add_filter( 'invoicexpress_woocommerce_document_item', function( $item_data, $item, $product, $order_object, $document_type, $args ) { | |
// Do whatever you want with the $item_data array, for example, change its reference or description | |
$item_data['name'] = 'whatever'; | |
/ /Or add somthing to its description | |
$item_data['description'] .= 'whatever'; | |
// And return it | |
return $item_data; | |
}, 10, 6 ); | |
// Remove item from the document | |
add_filter( 'invoicexpress_woocommerce_document_item', function( $item_data, $item, $product, $order_object, $document_type, $args ) { | |
if ( $your_condition ) { | |
return false; | |
} | |
return $item_data; | |
}, 10, 6 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment