When creating a new gift card, I can't save it. How to fix it?

When creating a new gift card, I can't save it. How to fix it?

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.

      • Related Articles

      • Gift Card API

        1. Amasty\GiftCard\Api\ImageRepositoryInterface - class for managing gift card images: POST /V1/amgcard/image, method="save" - save a gift card image; PUT /V1/amgcard/image/:id, method="save" - save a gift card image by ID; DELETE ...
      • Gift Card | GraphQL methods

        Queries amGiftCardAccount(input: AmGiftCardAccountInput!) description: get gift card account information by code amGiftCardSetting description: get gift card module settings amGiftCardPreview(input: AmGiftCardPreviewInput) description: get rendered ...
      • Is it possible to rearrange and stylize elements on the gift card image?

        Starting from version 2.7.0, the Gift Card extension provides UI for editing and rearranging elements (expiry date, balance, etc.) on the gift card image right from the admin panel. To do so, add a new image in Gift Card → Images → Add New or open ...
      • How to fix a gift card image not showing in the email?

        There are a number of reasons for gift card images not showing in the email. To resolve this issue, kindly try the solutions below. 1. Please, note that for correct sending of images via emails, the module requires installation of the Imagick module ...
      • How to activate the gift card account?

        Out of the box, the gift card account is created automatically when the order is invoiced and paid. Since v. 2.18.0 of Gift Card extension it is possible to create gift code accounts and send gift card emails right after the order creation, along ...