diff --git a/postnl-for-woocommerce.php b/postnl-for-woocommerce.php index 27dfb91b..1563b610 100644 --- a/postnl-for-woocommerce.php +++ b/postnl-for-woocommerce.php @@ -5,8 +5,11 @@ * Description: With this plug-in you can easily confirm your PostNL shipments and print shipping labels in no time. In addition, your customers are more in control because they choose where and when they receive their order. * Author: PostNL * Author URI: https://postnl.post/ + * License: GPLv2 or later + * License URI: https://www.gnu.org/licenses/gpl-2.0.html * Version: 5.6.2 - * Tested up to: 6.6 + * Tested up to: 6.7 + * Requires Plugins: woocommerce * WC requires at least: 4.0 * WC tested up to: 9.3 * diff --git a/readme.txt b/readme.txt index 01022335..824ed666 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: PostNL, shadim, abdalsalaam Tags: woocommerce, export, delivery, packages, PostNL, Shipping Requires at least: 4.6 Requires PHP: 5.6 -Tested up to: 6.6 +Tested up to: 6.7 Stable tag: 5.6.2 WC requires at least: 4.0 WC tested up to: 9.3 diff --git a/src/Emails/WC_Email_Smart_Return.php b/src/Emails/WC_Email_Smart_Return.php index 305d9c77..d74feeba 100644 --- a/src/Emails/WC_Email_Smart_Return.php +++ b/src/Emails/WC_Email_Smart_Return.php @@ -53,7 +53,7 @@ public function __construct() { * @since 3.1.0 */ public function get_default_subject() { - return __( '[{site_title}]: PostNL Smart Returns', 'woocommerce' ); + return __( '[{site_title}]: PostNL Smart Returns', 'postnl-for-woocommerce' ); } /** @@ -63,7 +63,7 @@ public function get_default_subject() { * @since 3.1.0 */ public function get_default_heading() { - return __( 'PostNL Smart Returns', 'woocommerce' ); + return __( 'PostNL Smart Returns', 'postnl-for-woocommerce' ); } /** diff --git a/src/Frontend/Base.php b/src/Frontend/Base.php index 94fac7e9..ff2b39ad 100644 --- a/src/Frontend/Base.php +++ b/src/Frontend/Base.php @@ -240,7 +240,7 @@ public function validate_posted_data( $data ) { $nonce_value = wc_get_var( $_REQUEST['woocommerce-process-checkout-nonce'], wc_get_var( $_REQUEST['_wpnonce'], '' ) ); // phpcs:ignore $expiry_message = sprintf( /* translators: %s: shop cart url */ - __( 'Sorry, your session has expired. Return to shop', 'woocommerce' ), + __( 'Sorry, your session has expired. Return to shop', 'postnl-for-woocommerce' ), esc_url( wc_get_page_permalink( 'shop' ) ) ); diff --git a/src/Order/Bulk.php b/src/Order/Bulk.php index c0dbda4b..e12f476c 100644 --- a/src/Order/Bulk.php +++ b/src/Order/Bulk.php @@ -148,7 +148,7 @@ public function bulk_action_change_shipping_options( $redirect, $doaction, $obje $match_pickup_zone = 'PICKUP' === $zone && 'NL' === $this->get_shipping_zone( $order ); if ( $have_label_file ) { $array_messages[] = array( - 'message' => sprintf( esc_html__( 'Order #%1$d already has a label.', 'postnl-for-woocommerce' ), $order_id ), + // Translators: %1$d is the order ID.'message' => sprintf( esc_html__( 'Order #%1$d already has a label.', 'postnl-for-woocommerce' ), $order_id ), 'type' => 'error', ); @@ -157,7 +157,7 @@ public function bulk_action_change_shipping_options( $redirect, $doaction, $obje if ( ! $match_shipping_zones && ! $match_pickup_zone ) { $array_messages[] = array( - 'message' => sprintf( esc_html__( 'Order #%1$d is from another shipping zone.', 'postnl-for-woocommerce' ), $order_id ), + // Translators: %1$d is the order ID.'message' => sprintf( esc_html__( 'Order #%1$d is from another shipping zone.', 'postnl-for-woocommerce' ), $order_id ), 'type' => 'error', ); @@ -681,6 +681,7 @@ public function generate_label_and_notes( $order_id, $post_data ) { $order->add_order_note( $tracking_note, $customer_note ); $label_link = esc_url( $this->get_download_label_url( $order_id ) ); $result['message'] = array( + // Translators: %1$s is the order ID, %2$s is the link to download the file, %3$s is the closing link tag. 'message' => sprintf( esc_html__( '#%1$s : PostNL label has been created - %2$sdownload file%3$s', 'postnl-for-woocommerce' ), $order_id, '', '' ), 'type' => 'success', diff --git a/src/Order/Single.php b/src/Order/Single.php index ea91188f..181f7fb9 100644 --- a/src/Order/Single.php +++ b/src/Order/Single.php @@ -627,7 +627,10 @@ public function postnl_activate_return_function() { wp_send_json_success(); } else { - throw new \Exception( esc_html__( print_r( $response['errorsPerBarcode'][0]['errors'][0], true ) ) ); + $error_message = isset($response['errorsPerBarcode'][0]['errors'][0]) ? $response['errorsPerBarcode'][0]['errors'][0] : 'Unknown error'; + + // Translators: %s is the error message. + throw new \Exception( sprintf( esc_html__( 'Error: %s', 'postnl-for-woocommerce' ), esc_html( $error_message ) ) ); } } catch ( \Exception $e ) { wp_send_json_error( diff --git a/src/Rest_API/Shipping/Item_Info.php b/src/Rest_API/Shipping/Item_Info.php index 2468eacd..0598fcaa 100644 --- a/src/Rest_API/Shipping/Item_Info.php +++ b/src/Rest_API/Shipping/Item_Info.php @@ -993,7 +993,8 @@ protected function check_insurance_amount_limit( $backend_data, $order_total ) { } // For EU shipments, validate that insurance does not exceed €5000 elseif ( ! $is_non_eu_shipment && 'yes' === $backend_data['insured_shipping'] && $order_total > 5000 ) { throw new \Exception( - __( 'Insurance amount for EU shipments cannot exceed €5000. Your total is: ' . $order_total, 'postnl-for-woocommerce' ) + // Translators: %s is the order total. + sprintf( esc_html__( 'Insurance amount for EU shipments cannot exceed €5000. Your total is: %d', 'postnl-for-woocommerce' ), $order_total ) ); } } diff --git a/src/Shipping_Method/PostNL.php b/src/Shipping_Method/PostNL.php index 17c788f0..8fb6d47a 100644 --- a/src/Shipping_Method/PostNL.php +++ b/src/Shipping_Method/PostNL.php @@ -91,6 +91,7 @@ public function instance_form_fields( $form_fields ) { $currency_symbol = get_woocommerce_currency_symbol(); $form_fields['minimum_for_free_shipping'] = array( + // Translators: %s is the currency symbol. 'title' => sprintf( esc_html__( 'Free shipping from %s', 'postnl-for-woocommerce' ), $currency_symbol ), 'type' => 'number', 'desc_tip' => esc_html__( 'Keep empty if you don’t want to use Free shipping', 'postnl-for-woocommerce' ), diff --git a/src/Utils.php b/src/Utils.php index 23376c0f..f2cb21cf 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -692,8 +692,9 @@ public static function is_eligible_auto_letterbox( $order ) { $products = $order->get_cart(); } - $is_eligible = self::check_products_for_letterbox( $products ); - + if( isset( $products ) ) { + $is_eligible = self::check_products_for_letterbox( $products ); + } // Save the state for the order. if ( is_a( $order, 'WC_Order' ) ) { $order->update_meta_data( '_postnl_letterbox', $is_eligible ); diff --git a/templates/checkout/postnl-delivery-day.php b/templates/checkout/postnl-delivery-day.php index 5a2955c7..15aa17bf 100644 --- a/templates/checkout/postnl-delivery-day.php +++ b/templates/checkout/postnl-delivery-day.php @@ -53,7 +53,7 @@ class="" name="" class="postnl_sub_radio" value="" - + />