Last active
June 1, 2024 08:58
-
-
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 hidden or 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 (sku) | |
$item_data['name'] = 'whatever'; | |
// Or add something to its description (product title) | |
$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