Frequently Asked Questions
Automatically adding a gift to the cart in Magento 2 is a feature that can increase the sales of your online store. Vanilla Magento doesn't offer this functionality, but you can get it using our Free Giftextension.
→ Looking for a way to add a custom product attribute to Magento 2 programmatically? Check out the options in the guide
You need to follow these steps to add a product to the cart programmatically in our Magento 2 extension:
Step 1. The first step is to configure the general settings.
For this, go to Stores > Configuration > Amasty Extensions > Free Gift.
After that, open the General tab:
The Add Simple/Virtual/Downloadable Products Automatically, Without Confirmation function enables auto-adding of promo products to the cart. If you want paid products to be auto-added to your cart, select the Yes, discounted and free products option.
The Auto Add Free Items Based on Cart Amountfield indicates the cart amount type based on which the free item will be auto-added.
Step 2. On this step, you need to set up messages and notifications.
There are a lot of options on this step:
The Gifts Selection Method option determines the way customers select gifts in the shopping cart popup. (Multiple or One by one)
Enter Popup header text,'Add to Cart' button text, and Message For The Free Item In The Cart.
Use Prefix For The Free Item Name In The Order, if needed.
Add Free Gift Message field defines the pop-up message shown with promo items.
Define if you want to Open Popup Automatically and Show Original Price in the Popup.
Configure the Display Error Messages and Display Success Messages.
When the Display Remaining Gifts Counter option is On you can show the number of gifts available in a pop-up window.
If the Reminder about Available Promos option is enabled, then you can show a special available present reminder on the frontend pages. You can write your own message by setting the option to Yes.
Write a text for a Notification Message in the field of the same name.
Step 3. Next, you need to configure limitations.
You will see 2 dropdowns in this section:
Enable Do not Offer Promos for Products with Special Priceline setting if you do not want special price items to be applied with promo rules. This function helps avoid double discounts. When it is enabled, you are to configure the following field.
Enable the Do not Offer Promos for Configurable Products when Child has Special Pricelimitation setting if you do not want your custom products to be subject to promo rules if there is a special price for one or more subsidiary products.
Step 4. Then, configure banner settings.
4 fields are available in this section:
Set the Validate condition based on the field to the Product Page or Shopping Cart option.
The Enable Top Banners function shows banner ads at the top of the page.
The Enable After Product Description Banner function displays banners above the Add to cart button.
Set Yes in the Show One Banner Only field if you want one banner from the established rules to be displayed. Choose No if you want to show all banners.
Step 5. And the last point of configuration is to set up gift image settings.
In this section, you can customize the display of promo products.
You can set the following parameters: Gift Image Width and Height.
In the Product Attribute for Header/ Description section, you can apply text attributes like Name and Short Description to display more info about promo items when a buyer hovers over the promo product image.
This is just a small part of the settings for this module. You can find the rest in the user guide.
But if you don't want to dig into module settings yourself, you can fill in the form with the required config, and we will do everything for you.
This extension is compatible with the Multiple Coupons extension, which will allow your customers to use discount coupons. It can increase your customer loyalty and boost your sales.
In addition, you can read our article on why free gifts are a good marketing tool and how to use it properly to increase sales.