Closed oskar-olaussen closed 1 year ago
@oskar-olaussen By default, Magento 2 allows a maximum of 64 characters for the SKU of a product. This limit includes letters, numbers, and special characters. There is no option to put bigger value into database:
Paytrail support default Magento. You probably have something customised on your Magento commerce
@bartoszkaluzny-solteq Did you try to use the steps I provided? You are correct that a singular product cannot have a SKU longer than 64 characters. But you can have multiple customizable options with SKUs that are for example 50 characters long. If you select multiple of those the SKU on your order item will be longer than 100 characters. The SKU column in the sales_order_item is varchar(255) so it is not limiting it to 100 characters.
@oskar-olaussen Yes, I tried to create configurable product with two customizable options that has 50 characters each. And I've got this message while saving this product (see screenshot). By default, configurable products with their options are saved as simple products with specific options into database, and there is limit for 64 characters in product table.
@bartoszkaluzny-solteq Here are the steps from default Magento 2.4.5-p1.
I have a simple product:
It has two customizable options with long SKUs:
When selecting both of those the sales_order_item has a SKU that is 132 characters long:
@oskar-olaussen I was able to reproduce this issue. I will provide you more information when fix will be live.
@oskar-olaussen Issue has been worked out. There is no option to allow SKU over 100 characters due to API limitations. On module version 1.4.1 there is message for this exception.
Describe the bug The Paytrail API does not allow product codes longer than 100 characters. This is an issue since in Magento it is possible to have skus longer than 100 characters on the order item. For example having a product with multiple customizable options will cause an error pictured when paying your order on checkout with Paytrail.
To Reproduce Have a product with an SKU 50 characters long and with two customizable options that both have 50 characters long skus. Add the product and the customizable options to your cart. Checkout with Paytrail.
Expected behavior You are redirected to the payment portal.
Screenshots
Additional context One can work around this issue by truncating the length of the product code here https://github.com/paytrail/paytrail-php-sdk/blob/master/src/Model/Item.php#L198