Skip to content

Commit

Permalink
Character limit on line item name field
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnynotsolucky committed Dec 4, 2019
1 parent 5bd0c22 commit 8851430
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## Updated

- Replaced use of deprecated adjustment functions, `getAdjustmentsTotalByType`.
- Return maximum of 200 characters for the line item `Name` field.

## 1.2.5 - 2019-11-25

Expand Down
10 changes: 8 additions & 2 deletions src/services/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,15 @@ public function item(\SimpleXMLElement $xml, LineItem $item, $name='Item')
'SKU' => [
'callback' => function ($item) {
return $item->snapshot['sku'];
}
},
'cdata' => false,
],
'Name' => [
'callback' => function ($item) {
return substr($item->description, 0, 200);
},
'cdata' => false,
],
'Name' => 'description',
'Weight' => [
'callback' => function ($item) {
$weight_units = CommercePlugin::getInstance()->settings->weightUnits;
Expand Down

0 comments on commit 8851430

Please sign in to comment.