From a13f7e98042a8892257e77a9816ae2c9f60e059d Mon Sep 17 00:00:00 2001 From: Miika Arponen Date: Thu, 16 May 2019 14:10:18 +0300 Subject: [PATCH] 1000 characters truncation for product description --- CHANGELOG.md | 5 +++++ plugin.php | 2 +- src/Gateway.php | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10345c7..5509a1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.1-beta] - 2019-05-16 + +### Added +- A feature that truncates the product description to a maximum of 1000 characaters when sending it to the Checkout Finland API. + ## [1.1.0-beta] - 2019-04-24 ### Added diff --git a/plugin.php b/plugin.php index b334558..8ff551e 100644 --- a/plugin.php +++ b/plugin.php @@ -3,7 +3,7 @@ Plugin Name: Checkout Finland WooCommerce Payment Gateway Plugin URI: https://github.com/CheckoutFinland/plugin-woocommerce Description: WooCommerce extension for supporting Checkout Finland payment methods -Version: 1.1.0-beta +Version: 1.1.1-beta Author: Checkout Finland Author URI: http://www.checkout.fi/ Copyright: Checkout Finland diff --git a/src/Gateway.php b/src/Gateway.php index a55a1c4..b1ebdf4 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -1111,6 +1111,10 @@ protected function get_item_description( WC_Order_Item $item ) : string { $description = $item->get_name(); break; } + + // Ensure the description is maximum of 1000 characters long. + $description = substr( $description, 0, 1000 ); + return apply_filters( 'checkout_finland_item_description', $description, $item ); }