{"id":18366,"date":"2024-07-30T19:38:22","date_gmt":"2024-07-30T17:38:22","guid":{"rendered":"https:\/\/www.welaunch.io\/en\/?post_type=faq&p=18366"},"modified":"2024-07-30T19:38:22","modified_gmt":"2024-07-30T17:38:22","slug":"bottle-deposit-sevdesk-support","status":"publish","type":"faq","link":"https:\/\/www.welaunch.io\/en\/knowledge-base\/faq\/bottle-deposit-sevdesk-support\/","title":{"rendered":"Bottle Deposit SevDesk Support"},"content":{"rendered":"

This code snippet adds settings in the sevDesk add-on so that you can define a booking account for fees for each existing tax class in WooCommerce and a booking account for \u201cno tax class\u201d for fees:<\/p>\n

\r\nadd_filter( 'sevdesk_woocommerce_api_voucher_pos_fee_use_split_tax', '__return_false' );\r\n\r\nadd_filter( 'woocommerce_de_sevdesk_additional_booking_accounts', function( $settings, $booking_accounts ) {\r\n\r\n\t$tax_classes = WC_Tax::get_tax_classes();\r\n\tarray_unshift( $tax_classes, 'standard' );\r\n\t\r\n\tforeach ( $tax_classes as $tax_class ) {\r\n\r\n \t\t$settings[] = array(\r\n\t\t\t'name'\t\t\t\t=> sprintf( __( 'Booking Account - Fees - Tax Class %s', 'woocommerce-german-market' ), $tax_class ),\r\n\t\t\t'id'\t\t\t\t=> 'woocommerce_de_sevdesk_booking_fee_' . sanitize_title( $tax_class ),\r\n\t\t\t'type'\t\t\t\t=> 'select',\r\n\t\t\t'options'\t\t\t=> $booking_accounts,\r\n\t\t\t'default'\t\t\t=> 26,\r\n\t\t\t'class'\t\t\t\t=> 'sevdesk_select_booking_account'\r\n\t\t);\r\n\r\n\t }\r\n\r\n\t $settings[] = array(\r\n\t\t\t'name'\t\t\t\t=> __( 'Booking Account - Fees - No Tax Class', 'woocommerce-german-market' ),\r\n\t\t\t'id'\t\t\t\t=> 'woocommerce_de_sevdesk_booking_fee_no_tax_class',\r\n\t\t\t'type'\t\t\t\t=> 'select',\r\n\t\t\t'options'\t\t\t=> $booking_accounts,\r\n\t\t\t'default'\t\t\t=> 26,\r\n\t\t\t'class'\t\t\t\t=> 'sevdesk_select_booking_account'\r\n\t\t);\r\n\r\n\t return $settings;\r\n\r\n}, 99, 2 );\r\n\r\nadd_filter( 'sevdesk_woocommerce_api_voucher_pos_fee_accounting_type', function( $accounting_type, $fee ) {\r\n\r\n\tif ( is_object( $fee ) && method_exists( $fee, 'get_tax_class' ) ) {\r\n\r\n\t\t$tax_classes = WC_Tax::get_tax_classes();\r\n\t\tarray_unshift( $tax_classes, 'standard' );\r\n\r\n\t\t$taxes = $fee->get_taxes();\r\n\t\t\r\n\t\tif ( isset( $taxes[ 'total' ] ) ) {\r\n\t\t\t\r\n\t\t\tforeach ( $taxes[ 'total' ] as $fee_rate_id => $tax ) {\r\n\r\n\t\t\t\tif ( floatval( $tax ) > 0 ) {\r\n\r\n\t\t \t\t\tforeach ( $tax_classes as $tax_class ) {\r\n\t\t \t\t\t\t$rates = WC_Tax::get_rates_for_tax_class( $tax_class );\r\n\t\t \t\t\t\tif ( isset( $rates[ $fee_rate_id ] ) ) {\r\n\t\t \t\t\t\t\t\r\n\t\t \t\t\t\t\t$booking_account = get_option( 'woocommerce_de_sevdesk_booking_fee_' . sanitize_title( $tax_class ), 26 );\r\n\r\n\t\t \t\t\t\t\t$accounting_type[ 'id' ] = $booking_account;\r\n\t\t \t\t\t\t\treturn $accounting_type;\r\n\r\n\t\t \t\t\t\t}\r\n\t\t \t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t$booking_account = get_option( 'woocommerce_de_sevdesk_booking_fee_no_tax_class', 26 );\r\n\t$accounting_type[ 'id' ] = $booking_account;\r\n\treturn $accounting_type;\r\n\r\n}, 50, 2 );\r\n<\/pre>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","product_cat":[],"class_list":["post-18366","faq","type-faq","status-publish","hentry","faq_topics-woocommerce-bottle-deposit"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/18366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/comments?post=18366"}],"version-history":[{"count":1,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/18366\/revisions"}],"predecessor-version":[{"id":18367,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/18366\/revisions\/18367"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media?parent=18366"}],"wp:term":[{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/product_cat?post=18366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}