During the module installation, the extension creates attributes that are necessary for the correct operation of the module. If the gift card attributes were not created or were deleted, you may receive the error "The attribute with a "am_giftcard_prices" attributeCode doesn't exist. Verify the attribute and try again." or similar one. To resolve this issue and ensure that the gift card attributes are recreated, please, follow these steps:
1. Remove the gift card-related attributes from the eav_attribute table by executing the following SQL query to identify the gift card attributes which currently exist in your Magento:
SELECT * FROM eav_attribute WHERE attribute_code like 'am_%'
You should see a list of such attributes as am_giftcard_prices, am_allow_open_amount, am_open_amount_min, am_open_amount_max, am_giftcard_fee_enable, am_giftcard_fee_type, am_giftcard_fee_value, am_giftcard_type, am_giftcard_lifetime, am_email_template, am_giftcard_code_set and am_giftcard_code_image.
Once done, kindly remove the existing gift card attributes using this command:
DELETE FROM eav_attribute WHERE attribute_code = 'am_giftcard_usage'
Please note that instead of 'am_giftcard_usage' you should use the attribute_code of the gift card attributes found on your Magento.
2. After that kindly delete the setup patch for gift card sample data from the patch_list table. You may find the patch_id of the patch using the following command:
SELECT * FROM patch_list WHERE patch_name LIKE '%InstallSampleData%'
Delete the patch using the patch_id with the command:
DELETE FROM patch_list WHERE patch_id = 'patch_id'
3. Execute these commands:
php bin/magento setup:upgrade
php bin/magento cache:flush
After executing these commands, you should see that all necessary attributes are created.