Magento 2 Disable Gift Cards – A 10-Step Guide
Are gift cards causing issues in your Magento 2 store? The Magento 2 disable gift cards feature allows you to turn off the gift card option. It reduces unnecessary complexity and simplifies the checkout process.
This tutorial will provide a clear, step-by-step guide to disabling gift cards in your Magento 2 store.
Key Takeaways
-
Disabling Magento 2 gift cards requires a few simple steps in the admin panel.
-
Ensure to back up your store before making any configuration changes.
-
Test and verify the changes to ensure gift card functionality is properly disabled.
-
Disabling gift cards impacts customer accounts, including gift card balances.
-
You can re-enable gift cards in Magento 2 if needed.
-
Why Should You Back Up Your Magento 2 Store Before Disabling Gift Cards?
-
What Happens to Customer Accounts After Disabling Gift Cards?
What Are Gift Cards in Magento 2?
In Magento 2, gift cards allow customers to purchase a gift code that can be used as credit for future purchases.
A gift card product is sold in various denominations. Customers can either redeem it during checkout or send it as a gift to someone else.
Gift cards are a valuable feature for a Magento ecommerce store. They encourage customer loyalty and offer a flexible payment option. These cards are often integrated with the gift card extension. It provides the necessary functionality to enable, manage, and redeem gift cards within the Magento 2 platform.
Why Disable Gift Card Functionality From Magento 2?
1. Changing Business Model or Strategy
You are changing your business model or focus. If your store's goals shift, you will no longer need gift cards. For example, you might focus more on discount-driven sales or a different form of customer engagement. Disabling gift cards simplifies your store and ensures your offerings match your new focus.
2. Low Demand for Gift Cards
If gift card sales are low, they may not justify the effort. Your store might rarely see gift card purchases or gift card redemptions. In this case, you can simplify your business by disabling them. Disabling gift cards reduces administrative work and makes managing your store easier. Removing unnecessary features will also save time and effort.
3. Issues with Gift Card Extension or Compatibility
Third-party gift card extensions can cause issues with Magento 2. So, if you don't want to rely on a third-party extension, disabling the feature is the solution. They can also conflict with other extensions, causing errors or problems in checkout. If this happens, you can deactivate gift cards until the issues are fixed.
4. Simplifying Checkout and Payment Options
Gift cards can complicate the checkout process. Customers have to follow extra steps to redeem them. You can offer simpler options like credit card payments, PayPal, or store credits. Removing gift cards streamlines the checkout flow. A simpler checkout process can also improve the customer experience.
5. Legal and Compliance Reasons
There may be legal reasons for disabling gift cards. Some regions have strict rules about gift card balances, expiration dates, and fees. These rules can be complicated to manage. If this is the case, removing gift cards simplifies your operations, reduces the risk of legal issues, and keeps you compliant.
6. Security Concerns
Gift cards can be a target for fraud or abuse. If your store has experienced fraudulent transactions, it is safer to disable gift cards. Fraudulent purchases can result in financial losses and hurt your store's reputation. Removing gift cards lowers the chances of fraud and chargebacks.
7. System Performance Issues
A large number of gift card transactions can affect system performance. Managing gift card balances, codes, and redemptions can slow down your store. If you notice performance issues, disabling gift cards may improve speed. It is beneficial if you have many transactions happening simultaneously.
8. Customer Confusion
Some customers might need clarification about how to redeem gift cards. If gift card balances are not reflected properly, they will also need support. If this happens frequently, it is simpler to remove the feature. It reduces the number of support requests and helps improve the customer experience.
How to Disable Gift Cards in Magento 2?
To completely disable gift cards in Magento 2, you'll need to modify a few settings in the admin panel and update the XML configuration.
Step 1: Disable Gift Cards from the Admin Panel
I. Log in to the Magento Admin Panel
- Go to the Magento 2 admin page and log in using your store admin credentials.
II. Navigate to Configuration Settings
- From the left sidebar, go to Stores > Configuration.
III. Locate the Gift Card Settings
-
In the Configuration page, navigate to the Sales section.
-
Under Sales, click on Payment Methods.
-
Find the Gift Card settings area, which is usually listed as Magento 2 Gift Card or under any third-party gift card extension you are using.
IV. Disable Gift Cards
-
Go to Genral Configuration.
-
Look for the Enable Gift Cards setting. You'll likely see a dropdown with options like Yes or No.
-
Set it to NO to disable the gift card functionality across your store.
V. Save Configuration
- After making this change, click the Save Config button at the top-right corner of the screen.
Step 2: Disable the Gift Card Functionality in the Store Catalog
Next, you'll need to disable the gift card product from your catalog to prevent customers from purchasing it.
I. Access the Product Catalog
- Go to Catalog > Products from the sidebar.
II. Find Gift Card Products
- Search your catalog for all gift card products. These products may be called 'Gift Card' or 'Store Credit.'
III. Disable Gift Card Products
-
Edit each gift card product and change its Status to Disabled.
-
Alternatively, if you're using a third-party gift card extension, the product type may be custom. Make sure to review the extension's documentation for any specific steps.
IV. Save Product Changes
- After disabling each gift card product, click Save to apply the changes.
If you want to programmatically disable the gift card product, you can use the following code to update its status. It ensures that the gift card is no longer visible or purchasable.
getObjectManager(); $state = $obj->get('Magento\Framework\App\State'); $state->setAreaCode('frontend'); $productId =; // Replace with your gift card product ID $product = $obj->create('Magento\Catalog\Model\Product')->load($productId); $product->setStatus(2); // 2 means Disabled $product->save(); echo "Gift Card product status has been updated to Disabled."; ?>
This PHP script will disable the gift card product by setting the status to 2
(disabled) for the specified product ID. You can run this script via CLI or place it temporarily in your Magento root directory and access it through the browser.
Step 3: Update the Database (Optional)
In some cases, you might need to disable the gift card functionality at the database level if your store uses custom extensions or additional configurations.
I. Access Your Database
-
Log into your MySQL or database management system (like PhpMyAdmin).
-
Run the following query to disable the gift card module:
UPDATE core\_config\_data SET value \= '0' WHERE path \= 'giftcard/general/enable';
This query disables the gift card extension at the database level.
II. Flush Cache
- After making database changes, flush the cache to apply the modifications. You can do this in Magento's admin panel under System > Tools > Cache Management.
Step 4: Disable Gift Card from Checkout
To remove the gift card option from the checkout, you will need to disable the gift card payment method and any custom logic related to gift cards in your checkout flow. If you're using Magento's built-in gift card feature, this is controlled by configuration settings.
I. Go to Stores > Configuration
-
Under Sales, select Checkout.
-
Scroll down to the Payment Methods section.
II. Disable the Gift Card Method
- If you're using a gift card extension, you may see a payment method listed as a Gift Card or something similar. To disable this payment method, set it to NO or disable it.
III. Save Configuration
- Click Save Config after making changes.
For a programmatic solution, you can disable gift card payment methods by updating the configuration using the following code in a custom script or via CLI:
getObjectManager(); $state \= $obj-\>get('Magento\\Framework\\App\\State'); $state-\>setAreaCode('frontend'); // Disable Gift Card payment method $configWriter \= $obj-\>get('Magento\\Config\\Model\\ResourceModel\\Config'); $configWriter-\>saveConfig('payment/giftcard/active', 0, 'default', 0); // Disables Gift Card payment echo "Gift Card payment method has been disabled."; ?>
Step 5: Update Email Templates
You can use the following code snippet to update email templates programmatically (removing references to gift cards). This script will search for any reference to "Gift Card" in your email templates and replace it with new text.
You can modify the str_replace
method to customize the content. It will also update the template for gift card-related content.
getObjectManager(); $state \= $obj-\>get('Magento\\Framework\\App\\State'); $state-\>setAreaCode('frontend'); $templateId \= \; // Replace with your email template ID $template \= $obj-\>create('Magento\\Email\\Model\\Template')-\>load($templateId); $template-\>setTemplateText(str\_replace('Gift Card', 'Alternative Text or New Content', $template-\>getTemplateText())); $template-\>save(); echo "Email template has been updated."; ?>
Step 6: Clear Cache and Reindex the Store
After making changes to the storefront, you should clear Magento's cache and reindex the store to apply the updates. Use the following commands in the CLI:
-
To clear the cache:
php bin/magento cache:flush
-
To reindex the store:
php bin/magento indexer:reindex
These commands should be run from the root directory of your Magento installation. You can also do this through the Admin Panel by navigating to System > Tools > Cache Management and Index Management.
Step 7: Remove the Gift Card from Frontend Theme
If you have custom logic for displaying gift cards on your frontend theme, you may need to modify the template files. For example, if you've added a banner or a specific link to gift cards in your layout files, you can find and remove it in the corresponding .phtml
files.
Make sure to check all relevant .phtml
files, especially in your app/design/frontend/
directory, where gift card references might be added.
For instance, if your header includes a link to the gift card page, find and remove it from your header.phtml
file:
getUrl('giftcard') . '">Gift Cards'; } ?>
Step 8: Edit XML Config (if applicable)
In some cases, gift card functionality is controlled via XML files, especially if you're using a third-party extension or custom module. Here's how to check and modify it.
I. Find the XML File
-
Go to your Magento root directory via FTP or File Manager.
-
Look for XML files for the Magento 2 gift card extension in the
app/code
orapp/design
directories, especially under the vendor's folder. Common files may includegiftcard.xml
orpayment.xml
.
II. Disable Gift Cards in the XML File:
- Open the relevant XML file and look for a section like this:
If the disabled
attribute is not present, you can manually add it.
III. Save and Recompile
-
After making changes to the XML files, save the changes and clear Magento's cache by running:
-
php bin/magento cache:clean
-
php bin/magento cache:flush
-
Step 9: Test Your Changes
I. Go to the Frontend
- After disabling gift cards, visit your store's front end to confirm that the gift card option is no longer visible in the product catalog or during checkout.
II. Check the Cart and Checkout
- Add items to the cart and go through the checkout process. Ensure that the gift card option is completely removed from the cart and that the checkout process does not display a gift card code field.
Step 10: Review Gift Card Data for Existing Orders
Even after disabling gift cards, you may still need to manage existing gift card balances for your customers. Follow these steps to review and manage them:
I. Check Gift Card Balances
-
Go to Customers > Manage Customers and select a customer.
-
View their gift card balance in the Customer Information section or check any custom fields related to gift cards.
II. Refunds and Adjustments
- Depending on your store's policies, you may need to process refunds or adjustments if customers have gift card credits left.
Why Should You Back Up Your Magento 2 Store Before Disabling Gift Cards?
1. Prevent Data Loss
Disabling gift cards may modify database entries or uninstall gift card extensions. It could lead to the loss of important data, such as:
-
Customer gift card balances
-
Gift card purchase history
-
Redemption records
A backup allows you to restore lost or corrupted data. It can also retain transaction records, customer credits, and the ability to re-enable gift cards.
2. Ensure You Can Roll Back Changes
Mistakes can happen during any process. If you disable gift cards and experience issues (like broken checkout pages or unexpected cart behavior), a backup lets you roll back.
Magento 2 allows you to restore your store to its previous state. It minimizes downtime and protects your store's reputation.
3. Avoid Disruption to the Customer Experience
Disabling gift cards could disrupt your customers' shopping experience. If a customer buys a gift card but cannot use it, frustration may occur. Modifying catalog items or payment methods may affect live orders.
A backup ensures quick fixes. You can restore previous configurations to avoid service disruption.
4. Prevent Issues with Customizations or Third-Party Extensions
If you use a third-party gift card extension, custom code, or special configurations, issues could arise. These extensions might conflict with Magento's core updates or changes you make.
Backing up ensures you can recover from conflicts with extensions or custom code.
5. Backup Files and Database for Safe Configuration Changes
Magento 2 is complex. Disabling gift cards can have ripple effects throughout your store. Changes can cause problems that may not be immediately visible.
Some gift card extensions alter your store's backend. They may create custom database tables or new XML configurations. A backup captures:
-
Database tables
-
Extension configurations
-
Admin settings
-
Custom code (if applicable)
Restoring from the backup lets you avoid manual reconfiguration if something goes wrong.
6. Backup Before Large-Scale Changes or Updates
Disabling gift cards is part of more significant changes in your store. You must also update products, promotions, or other settings that conflict with gift card settings. Magento 2 updates could introduce new issues when removing features.
Backing up ensures that if you encounter problems during updates, you can restore your store to a fully functional state.
How to Back Up Your Magento 2 Store?
Step 1: Backup the Database
1. Access Your Hosting Provider's Control Panel
- Log in to your hosting account and go to the
phpMyAdmin
section under Databases.
2. Export the Database
-
In
phpMyAdmin
, select the Magento 2 database. -
Click Export at the top of the page.
-
Choose the Quick export method and select the SQL format.
-
Click Go to download a backup of your database.
Step 2: Backup Magento Files (via FTP)
1. Connect to FTP Server:
- Use an FTP client to connect to your server using the FTP credentials provided by your hosting provider.
2. Download Files
- Download the entire Magento root directory to your local machine. It includes the core Magento files, themes, and extensions, which are essential to restore the store's setup.
Step 3: Backup Media and Configuration Files
1. Media Files
- The
/pub/media/
directory contains all the uploaded media, including images, videos, and other assets. Make sure to back up this folder.
2. Configuration Files
- The
/app/etc/
folder contains important configuration files, such as theenv.php
andconfig.php
, which hold your store's setup, encryption keys, and database credentials.
Step 4: Use Magento's Command Line Tool (CLI)
If you prefer a command-line method, Magento provides a built-in backup command that allows you to back up both your files and database at once.
Run the following command in your Magento root directory via SSH:
php bin/magento setup:backup \--all
This command will back up both the database and the store's files. Make sure your server has SSH access enabled.
What Happens to Customer Accounts After Disabling Gift Cards?
1. Existing Gift Cards Remain Active
After disabling the gift card feature, existing gift cards remain active. Customers who have previously purchased gift cards can redeem them until their balance is depleted. However, no new gift cards will be issued, and customers cannot buy or activate new ones.
2. Gift Card Balances Stay Intact
The gift card balances in customer accounts are preserved. Magento 2 does not delete or alter existing balances, so customers can still apply their gift card amounts to purchases. If you ever re-enable gift cards, the balances will be available for use again.
3. Gift Card Codes Can Still Be Redeemed
Customers who have a gift card code can continue to redeem it during checkout. Magento will process the redemption as usual, applying the gift card value to the customer's order. But, if you choose to remove the Magento 2 coupon code redemption option completely, you'll need to make additional configurations.
4. No New Gift Card Purchases
Once the feature is disabled, the gift card product will be removed from the catalog and the checkout process. If the store is using a third-party gift card extension, you'll need to ensure that the extension is fully disabled to prevent further gift card purchases.
5. Gift Card Redemptions May Be Limited
Once the gift card redemption option is entirely removed from the checkout, customers will not be able to apply gift cards to new purchases. In this case, store owners should inform the customers of the change. Provide clear instructions on how they can use their remaining gift card balances before they expire.
6. Customer Notification and Communication
It's important to notify customers about the changes. You can use Magento's default email templates to send out notifications or create a custom notification email. Let customers know if they have a remaining balance and how long it will be valid.
7. Handling Refunds for Unused Gift Cards
If you have disabled gift cards and a customer requests a refund for a purchase made with a gift card, the system will apply the refund to the original payment method (if possible). However, if the gift card code was used, you should manually manage the refund and track it in the customer account.
8. Impact on Customer Loyalty
Removing or disabling the gift card feature may affect customer loyalty. Some customers may use gift cards as a form of store credit. If you rely on gift cards as part of a loyalty program or promotion, disabling them could affect customer satisfaction. It's a good idea to offer alternatives, like discount codes, to retain customer engagement.
How to Re-Enable Gift Cards in Magento 2?
1. Enable the Gift Card Feature from the Admin Panel
-
Go to your Magento 2 admin page and log in using your store admin credentials.
-
From the left sidebar, go to Stores > Configuration.
-
Under the Sales section, click on Payment Methods.
-
Find the Gift Card settings (or a third-party gift card extension if you're using one).
-
Set Enable Gift Cards to Yes.
-
Click on Save Config in the upper-right corner.
2. Enable Gift Card Products in the Catalog
-
Navigate to Catalog > Products in the Magento Admin.
-
Use the search functionality to find gift card products.
-
Click Edit for each gift card product.
-
Change the Status from Disabled to Enabled.
-
Save the changes.
Alternatively, you can use the following PHP script to enable the gift card product. Run this script via CLI or place it in your Magento root directory and execute it.
getObjectManager(); $state \= $obj-\>get('Magento\\Framework\\App\\State'); $state-\>setAreaCode('frontend'); $productId \= \; // Replace with your gift card product ID $product \= $obj-\>create('Magento\\Catalog\\Model\\Product')-\>load($productId); $product-\>setStatus(1); // 1 means Enabled $product-\>save(); echo "Gift Card product status has been updated to Enabled."; ?>
3. Re-Enable Gift Card Payment Option at Checkout
-
Go to Stores > Configuration.
-
Under Sales, click Payment Methods.
-
Find the Gift Card payment method and set Enable Gift Card Payment to Yes.
-
Click Save Config.
4. Re-Enable Gift Card Code Usage
-
Navigate to Stores > Configuration > Sales > Gift Cards.
-
Set the option for Allow Gift Card Redemption to Yes.
-
Save the changes.
5. Update Storefront to Reflect Gift Card Availability
-
Add Gift Card Links and Banners:
-
Update your storefront by re-adding links or banners that promote gift cards.
-
Go to Content > Design > Configuration.
-
Edit your store view and add gift card promotions where needed.
-
-
Add Gift Card Blocks Back to the Theme
- Update your theme's .phtml files to add any gift card CTA buttons or links that were previously removed. For example, in your header file (
header.phtml
):
- Update your theme's .phtml files to add any gift card CTA buttons or links that were previously removed. For example, in your header file (
getUrl('giftcard') . '">Gift Cards'; ?>
-
Check Email Templates for Gift Card Information
-
Re-enable any email templates that notify customers about gift card purchases, updates, or balances.
-
Go to Marketing > Email Templates.
-
Ensure that any disabled gift card-related email templates are now active.
-
6. Clear Cache and Reindex Store
These commands will help make sure the updates are visible across your store.
-
Clear Cache:
php bin/magento cache:flush
-
Reindex the Store:
php bin/magento indexer:reindex
7. Test the Storefront
-
Ensure the gift card product is visible.
-
Make sure that customers can use gift card codes during checkout.
-
Preview and confirm that existing gift card codes work properly and apply correctly.
-
Make sure email notifications related to gift cards are being sent as expected.
FAQs
1. What are the alternatives to gift cards in Magento 2?
Discount codes and store credits are excellent alternatives to gift cards in Magento 2. Discount codes can be applied during checkout for instant savings, while store credits allow customers to use a specific balance toward future purchases. Both options are easy to manage and integrate well with Magento's promotional features.
2. How to use discount codes as a replacement for gift cards?
Create discount codes in the Magento Admin by navigating to Marketing > Cart Price Rules. Define the discount amount, eligibility, and duration. Share these codes with customers as a gift card alternative. Customers can then apply these discount codes during checkout for reduced order totals.
3. When should you seek professional help to disable gift cards?
Seek professional help if your store uses a third-party gift card extension or custom configurations, as there may be risks of incompatibility or data loss. Also, if you're unfamiliar with making changes in the Magento backend or modifying code, a Magento expert can ensure the process is smooth and error-free.
4. How to use Magento_giftcard settings to disable the module?
You can access the Magento_giftcard module settings via the Magento admin panel. Navigate to Stores > Configuration > Advanced > Advanced. Locate Magento_GiftCard
and set the Enable Gift Card Module to Disable. Save the changes to ensure that the gift card functionality is no longer available in your store.
5. How can stores disable gift card functionality for specific products in Magento 2?
Stores must assign gift card functionality settings through the admin interface to disable gift cards for specific products. By configuring product options, stores can browse the product catalog and prevent certain items from being eligible for gift card usage during checkout.
6. Can I remove gift card options from the shopping cart after a customer adds them?
Yes, you can modify the back-end settings to remove the gift card option from the shopping cart. You can do this by configuring the gift card extension to exclude the gift card during checkout or at a specific point in the order status flow.
7. How to configure gift card expiration and validity periods in Magento 2?
The extension’s settings in the admin interface allow you to configure the validity of gift cards. Set the expiration date and define the terms of service. The system will automatically prevent the use of expired cards, ensuring customers agree to our terms before making a purchase.
Summary
The tutorial shows how to disable gift cards using admin settings and XML configuration. This tutorial discusses:
-
Disabling gift cards simplifies store management, especially with low gift card demand.
-
The process includes removing gift cards from the catalog, checkout, and email templates.
-
It is essential always to back up your store to prevent data loss.
-
The impact on accounts includes preserving balances but restricting new purchases.
-
It also explains how to re-enable gift cards when needed for flexibility.
Need reliable support for your Magento store? Check out managed Magento hosting services for help with managing your store's gift cards.