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 May 21, 2024 15:41
Use Fremdleistungen § 13b instead of Innergemeinschaftliche Lieferung as lexoffice category
<?php
add_filter( 'storeabill_external_sync_lexoffice_voucher_item_category_id', 'my_child_adjust_lexoffice_category_id', 10, 3 );
function my_child_adjust_lexoffice_category_id( $category, $item, $invoice ) {
$categories = array(
'reverse_charge' => '9075a4e3-66de-4795-a016-3889feca0d20',
'fremdleistungen' => '380a20cb-d04c-426e-b49c-84c22adfa362',
);
@dennisnissle
dennisnissle / functions.php
Created May 10, 2024 11:39
Disable Germanized Shipments Integration mini Plugin
<?php
/**
* Plugin Name: Disable Germanized Shipments
* Plugin URI: https://www.vendidero.de/woocommerce-germanized
* Description: Disables the Germanized Shipments integration
* Version: 1.0.0
* Author: vendidero
* Author URI: https://vendidero.de
*
* @author vendidero
@dennisnissle
dennisnissle / functions.php
Created May 7, 2024 10:29
Display WooCommerce Appointments data for invoice items by using [document_item_reference data="woocommerce_appointments"]
<?php
add_filter( 'storeabill_shortcode_get_document_item_reference_data', function( $result, $atts, $reference, $shortcodes ) {
if ( 'woocommerce_appointments' === $atts['data'] && class_exists( 'WC_Appointment_Data_Store' ) ) {
$item = $reference->get_object();
if ( is_a( $item, 'WC_Order_Item_Product' ) ) {
$appointment_ids = WC_Appointment_Data_Store::get_appointment_ids_from_order_and_item_id( $item->get_order_id(), $item->get_id() );
foreach ( $appointment_ids as $appointment_id ) {
@dennisnissle
dennisnissle / functions.php
Created April 23, 2024 09:13
Move pickup location fields to order review wrapper in classic checkout
<?php
add_action( 'woocommerce_checkout_before_order_review', function() {
$fields = \Vendidero\Germanized\Shipments\PickupDelivery::register_classic_checkout_fields( array( 'order' => array() ) );
foreach( $fields['order'] as $key => $field ) {
woocommerce_form_field( $key, $field, wc()->checkout()->get_value( $key ) );
}
}, 20 );
@dennisnissle
dennisnissle / functions.php
Created April 23, 2024 08:42
Disable registering pickup location fields
<?php
add_filter( 'woocommerce_gzd_shipments_pickup_delivery_available', '__return_false' );
@dennisnissle
dennisnissle / functions.php
Created March 20, 2024 15:04
Register a custom min age
<?php
add_filter( 'woocommerce_gzd_age_verification_min_ages', function( $min_ages ) {
$min_ages[14] = '>= 14 Jahre';
return $min_ages;
} );
@dennisnissle
dennisnissle / functions.php
Created February 28, 2024 09:51
Force allow label third-party email transmission
<?php
add_filter( 'woocommerce_gzd_shipment_label_supports_third_party_email_notification', '__return_true' );
add_filter( 'woocommerce_gzd_shipment_return_label_supports_third_party_email_notification', '__return_true' );
@dennisnissle
dennisnissle / functions.php
Created February 28, 2024 09:06
Use a different invoice template based on country
<?php
add_filter( 'storeabill_invoice_get_template', function( $template, $invoice ) {
$country = $invoice->get_taxable_country();
$template_id = false;
if ( 'AT' === $country ) {
$template_id = 320;
} elseif ( $invoice->is_eu() ) {
$template_id = 323;
@dennisnissle
dennisnissle / functions.php
Created February 26, 2024 09:53
Always auto calculate unit prices
<?php
add_filter( 'woocommerce_gzd_get_product_unit_price_auto', '__return_true' );
@dennisnissle
dennisnissle / functions.php
Created February 21, 2024 10:30
Change email customer title to company name
<?php
add_filter( 'woocommerce_gzd_email_title', function( $email_title, $order ) {
$email_title = 'Hallo ' . $order->get_billing_company();
return $email_title;
}, 10, 2 );