Skip to content

Instantly share code, notes, and snippets.

View dennisnissle's full-sized avatar

Dennis Nissle dennisnissle

View GitHub Profile
@dennisnissle
dennisnissle / functions.php
Created November 28, 2025 08:44
Use a different invoice template for orders with company field
<?php
add_filter( 'storeabill_invoice_get_template', function( $template, $invoice ) {
$template_id = false;
if ( ! empty( $invoice->get_company() ) ) {
$template_id = 320; // Post id of the template to be used
}
if ( $template_id ) {
@dennisnissle
dennisnissle / functions.php
Created November 4, 2025 10:15
Send paid for order mail for invoice gateway too
<?php
add_filter( 'woocommerce_gzd_disable_gateways_paid_order_email', function( $gateways ) {
$gateways = array_diff( $gateways, array( 'invoice' ) );
return $gateways;
} );
@dennisnissle
dennisnissle / functions.php
Created September 16, 2025 07:45
Send invoice to admin on order status pending to processing
<?php
add_action( 'woocommerce_order_status_pending_to_processing_notification', function( $order_id ) {
if ( $order = sab_get_order( $order_id ) ) {
if ( $invoice = $order->get_latest_finalized_invoice() ) {
$invoice->send_to_admin();
}
}
}, 10 );
@dennisnissle
dennisnissle / functions.php
Created August 15, 2025 07:19
Adjust invoice email address
<?php
add_filter( 'storeabill_woo_order_email', function( $billing_email, $invoice_order ) {
$wc_order = $invoice_order->get_order();
return $billing_email;
}, 10, 2 );
@dennisnissle
dennisnissle / functions.php
Created August 5, 2025 08:00
Adjust journal type when syncing invoice
<?php
add_action( 'storeabill_woo_order_synced_invoice', function( $invoice, $sab_order ) {
$woo_order = $sab_order->get_order();
// Check products and determine whether to use a custom journal type
$condition = false;
if ( $condition ) {
$custom_journal_type = 'custom_invoice';
@dennisnissle
dennisnissle / functions.php
Created July 28, 2025 07:41
Set shipment status to processing (instead of ready-for-shipping) after creating label
<?php
add_filter( 'woocommerce_shiptastic_shipment_status_after_label_creation', function() {
return 'processing';
} );
@dennisnissle
dennisnissle / functions.php
Created July 23, 2025 11:04
Adjust OSS threshold amount
<?php
add_filter( 'oss_woocommerce_delivery_threshold', function() {
return 12000;
} );
@dennisnissle
dennisnissle / functions.php
Created July 14, 2025 06:58
Disable unit price observer in Germanized
<?php
add_filter( 'woocommerce_gzd_refresh_unit_price_on_price_change', '__return_false' );
@dennisnissle
dennisnissle / functions.php
Last active July 14, 2025 06:38
Prevent invoices which are paid by invoice from being marked as paid when order is completed
<?php
add_filter( 'storeabill_woo_order_is_paid', function( $is_paid, $order ) {
if ( 'invoice' === $order->get_payment_method() ) {
$is_paid = false;
}
return $is_paid;
}, 10, 2 );
@dennisnissle
dennisnissle / functions.php
Last active June 23, 2025 08:52
Show product thumbnails in shipping notification
<?php
add_filter( 'woocommerce_shiptastic_email_shipment_items_args', function( $args ) {
$args['show_image'] = true;
return $args;
} );