Skip to content

Commit

Permalink
✨ Add description for product line
Browse files Browse the repository at this point in the history
  • Loading branch information
larasmorningtrain committed Jan 9, 2024
1 parent 72a2496 commit b5efa3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/WoocommerceEconomic.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public static function init(): void
add_action('woocommerce_variation_options', [ProductService::class, 'addEconomicProductField']);
add_action('woocommerce_save_product_variation', [ProductService::class, 'saveEconomicProductField'], 10, 2);
add_action('woocommerce_process_product_meta', [ProductService::class, 'saveEconomicProductField'], 10, 2);

add_action(ActionScheduleService::CREATE_INVOICE, [ActionScheduleService::class, 'handleCreateInvoiceJob'], 10, 2);
add_action(ActionScheduleService::CREATE_INVOICE, [ActionScheduleService::class, 'handleCreateInvoiceJob'], 10, 1);
}

public static function registerGateway($gateways): array
Expand All @@ -28,6 +27,6 @@ public static function registerGateway($gateways): array

public static function requireGateway(): void
{
require_once __DIR__.'/woocommerce/WC_Gateway_Economic_Invoice.php';
require_once __DIR__ . '/woocommerce/WC_Gateway_Economic_Invoice.php';
}
}
8 changes: 5 additions & 3 deletions src/woocommerce/OrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ private static function getRecipient(\WC_Order $order, ?VatZone $vatZone): Recip
}

return Recipient::new(
name: $order->get_shipping_first_name().' '.$order->get_shipping_last_name(),
name: $order->get_shipping_first_name() . ' ' . $order->get_shipping_last_name(),
vatZone: $vatZone,
address: $order->get_shipping_address_1().' '.$order->get_shipping_address_2(),
address: $order->get_shipping_address_1() . ' ' . $order->get_shipping_address_2(),
zip: $order->get_shipping_postcode(),
city: $order->get_shipping_city(),
country: $order->get_shipping_country(),
Expand Down Expand Up @@ -147,7 +147,7 @@ private static function addLineItems(\WC_Order $order, DraftInvoice $invoice, \W

$product = self::getEconomicProduct($item, $invoice);

if ($product) {
if (! $product) {
EconomicLoggerService::critical('Product not found', [
'product_id' => $item->get_product_id(),
'economic_product_id' => $item->get_meta('economic_product_id'),
Expand All @@ -160,6 +160,7 @@ private static function addLineItems(\WC_Order $order, DraftInvoice $invoice, \W
product: $product->productNumber,
quantity: $item->get_quantity(),
unitNetPrice: $item->get_total(),
description: $item->get_name(),
));
});

Expand All @@ -175,6 +176,7 @@ private static function addLineItems(\WC_Order $order, DraftInvoice $invoice, \W
product: $paymentMethod->get_option('economic_shipping_product'),
quantity: 1,
unitNetPrice: $order->get_shipping_total(),
description: __('Fragt', 'mt-wc-economic'),
));

return $invoice;
Expand Down

0 comments on commit b5efa3b

Please sign in to comment.