Hi
My Magento store 2.4 CE creates product SKU codes using name when adding new products via the backend admin area. This is therefore creating SkU codes Based on the product name, this behavior, therefore, creates SKU codes with spaces and exactly as entered in the product code field. This goes against Magento's own advice in naming recommendations for SKU codes. I.E using space or special characters in this field!
Looking at the product's SKU codes when a code is not entered manually it duplicated the name field including any spaces or special characters.
This seems bad practice
what solutions are advised to deal with this? The most obvious I can see would be to remove the {name} placeholder?
Hello @darrenplaydace
To solve the issue and stop auto-generating SKUs based on product names:
Disable Auto Generation for SKU
In Magento 2.4 CE, the product SKU field should support the use of placeholders like {name} to automatically generate SKUs based on product attributes. However, there have been some issues reported regarding the placeholder behavior in earlier versions of Magento 2.4.
If you are facing issues with the {name} placeholder not working as expected, here are a few things you can check and try to resolve the problem:
1. Verify Placeholder Format: Make sure you are using the correct placeholder format. The correct format for the product name placeholder is {attribute_code}, where "attribute_code" should be replaced with the actual attribute code for the attribute you want to use in the SKU.
2. Attribute Code: Ensure that the attribute code used in the placeholder corresponds to a valid attribute that is set up to be used in SKUs. You can check this by going to Stores > Attributes > Product, and make sure that the attribute you want to use in the SKU has "Use in SKU" set to "Yes."
3. SKU Template: Check the SKU template configuration for the product. Go to Stores > Configuration > Catalog > Catalog > Product Fields Auto-Generation, and look for the "SKU Template" setting. Make sure the template is set up correctly and includes the correct placeholder for the attribute you want to use.
4. Reindex: After making any changes to product attributes or SKU template, it's essential to reindex your Magento store. Go to System > Index Management and click "Reindex" to ensure that the changes are reflected correctly.
5. Flush Cache: Clear your Magento cache to ensure that any changes to attribute settings or SKU templates take effect immediately. Go to System > Cache Management and click "Flush Magento Cache."
6. Update to Latest Version: If you are using an earlier version of Magento 2.4, consider updating to the latest version, as newer versions often include bug fixes and improvements.
If you have checked all the above steps and the {name} placeholder is still not working as expected, there may be a specific issue or bug with your Magento installation. In that case, I recommend checking the Magento community forums or the USPayserv official Magento GitHub repository for any known issues related to SKU placeholders. If the problem persists, consider reaching out to the Magento support team or posting a detailed bug report on the Magento GitHub repository to get assistance from the Magento development community.
Hi,
I understand the use of SKU's but I would like to use the following Mask for SKU:
The first 3(or whatever we want) characters of each placeholder only?
{attribute_code1}{attribute_code2}-{attribute_code3}-{attribute_code4}
So if:
Attribute_code1 = 1attribute
Attribute_code2 = 2attribute
Attribute_code3 = 3attribute
Attribute_code4 = 4attribute
The SKU would be = 1at2at-3at-4at