Skip to content

Commit

Permalink
Use shipments package filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisnissle committed Sep 5, 2024
1 parent 3e1db7d commit 37496ed
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public function register_main_breadcrumb( $main_breadcrumb ) {
}

public function get_description() {
return __( 'Create shipments, improve packing and manage available shipping providers.', 'woocommerce-germanized' );
return __( 'Create shipments, improve pick & pack and manage available shipping provider.', 'woocommerce-germanized' );
}

public function get_label() {
return __( 'Shipments', 'woocommerce-germanized' );
return _x( 'Shipments & Shipping Provider', 'shipments-settings-tab', 'woocommerce-germanized' );
}

public function get_name() {
Expand Down
10 changes: 10 additions & 0 deletions includes/class-wc-gzd-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ public function __construct() {
* Other services (e.g. virtual, services) are not taxable in northern ireland
*/
add_action( 'woocommerce_before_calculate_totals', array( $this, 'maybe_remove_northern_ireland_taxes' ), 15 );

/**
* Tell the shipment integration whether prices include taxes or not.
*/
add_filter(
'woocommerce_gzd_shipments_additional_costs_include_tax',
function() {
return wc_gzd_additional_costs_include_tax();
}
);
}

public function maybe_remove_northern_ireland_taxes( $cart ) {
Expand Down
16 changes: 16 additions & 0 deletions includes/class-wc-gzd-order-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public function __construct() {
*/
add_action( 'woocommerce_order_item_after_calculate_taxes', array( $this, 'recalculate_order_item_unit_price' ), 60, 1 );

add_filter( 'woocommerce_gzd_shipment_order_supports_email_transmission', array( $this, 'shipment_order_supports_email_transmission' ), 10, 2 );

// Add Title to billing address format
add_filter(
'woocommerce_order_formatted_billing_address',
Expand Down Expand Up @@ -157,6 +159,20 @@ function() {
}
}

/**
* @param boolean $supports_email_transmission
* @param \Vendidero\Germanized\Shipments\Order $order
*
* @return boolean
*/
public function shipment_order_supports_email_transmission( $supports_email_transmission, $order ) {
if ( wc_gzd_order_supports_parcel_delivery_reminder( $order->get_id() ) ) {
$supports_email_transmission = true;
}

return $supports_email_transmission;
}

/**
* @param WC_Order_Item $item
* @param WC_Order_Item|false $old_item
Expand Down

0 comments on commit 37496ed

Please sign in to comment.