Skip to main content

Extra Fee

Overview​

Magento currently only supports certain shipping methods: Free Shipping, Flat Rate, Table Rate, UPS, Magento Shipping, USPS, FedEx, DHL. If store owners want to add fees for any services in their store like gift wrap, fast shipment within 2 hours, etc, they can not be configured. Developed by Mageplaza, Magento 2 Extra Fee module allows shoppers to add whatever fees they want and display them on their Checkout and Shopping Cart pages.

Download and Install​

How to configure​

From the Admin Panel, go to Stores > Extra Fee > Configuration

1. Configuration​

From the Admin Panel, go to Stores > Extra Fee > Configuration, choose General sections

  • Enable: Select Yes to use the feature of the module
  • Calculate Total includes: Choose how to calculate the service cost
    • Calculate Total includes = Discount: the service fee includes the discount
    • Calculate Total includes = Shipping Fee: The service fee is calculated after shipping surcharge
    • Calculate Total includes = Tax: The service fee includes the tax of the product
    • Many options can be selected
    • Only apply this calculation method with the fee type as a percentage
  • Show Extra Fee on the Order Grid: If Yes, the extra fee information will be displayed in the order grid.
  • Display Extra Fees on Product Page: Select Yes to display extra fee information of the product on the product page.
    • Title: Enter title of all extra fees on the product page.

    • Display Extra Fees on Product Page: Select the display position for all extra fees on the product page. There are 2 positions:

      • Before Add to Cart button:

      • After Add to Cart button:

2. Manage Extra Fees​

How to Add New Rule​

  • Step 1: Enter the full information in the General section
  • Step 2: Set the conditions to apply the rule in the Condition section
  • Step 3: Set the form, service fee, display area ... of the rule in Action section
  • Step 4: Enter labels for service type for the store and in the backend
Step 1: Enter the full information in the General section​
  • Name: Enter the name of the rule
  • Status: Select "Enable" to apply the rule
  • Description: Enter the information to desribe the extra fee

  • Store Views

    • Only selected stores are applied the rule
    • Multiple stores can be selected at the same time
  • Customer Groups

    • Only selected customer group can see the rule
    • Multiple groups can be selected at the same time
  • Priority Β  - Enter the priority for applying the rule

    • The smaller the number, the higher the priority. For rules with equal priority, the priority will be based on ID.

Step 2: Set the conditions to apply the rule in the Condition section​
  • Select conditions to apply the rule
  • You can set the conditions for the Cart or Product, Customer and Other…. section as Subtotal greater than 50, Total Items Quantity less than 5, Quantity In Stock, conditions based on customer information, etc.

Step 3: Set the form, service fee, display area ... of the rule in Action section​
  • Apply Type:

  • Apply Type: Automatic

If choose to Apply for the Whole Cart: there are three fee types:

  • Fee Type = Percentage of cart total: Service fee will be calculated as a percentage of the total cart
  • Fee Type = Fixed amount for the whole cart: Service fee will be charged as a certain amount when the customers purchase the products
  • Fee Type = Fixed amount for each item: The service fee will be calculated as a certain amount on each item in the cart

If to choose Apply for each product in cart: there are two fee types:

NOTED: Choosing apply for each product in cart means only products meet the conditions below will be calculated for the rule

  • Fee Type = Percentage of cart total: Service fee will be calculated as a percentage of the total cart

  • Fee Type = Fixed amount for each item: fixed value for products

  • Fee Type = Percentage of each item: calculate extra fee according to % of each product

  • Apply Type = Manual: Customers can optionally choose the service type of the rule

    • Display Area: Choose the area to show the rule

  • Display Area = Cart Summary: Display the rule in the Cart Summary section

  • Display Area = Shipping Method: Display the rule in the Shipping Method section

  • Display Area = Payment Method: Display the rule in the Payment Method section

  • **Display Type`: Choose the display type of the rule for customers to choose

  • Display Type = Radio: Allow choosing the display type as radio

  • Display type= Select: Allow choosing the display type as select

  • Display Type = Checkbox: Allow choosing the display type as checkbox

  • Is Required: Choose Yes to force customers to choose at least one service type.

  • Apply Type = Automatic: Service type of the rule will be applied automatically.

  • Fee Amount

    • Enter the amount or percentage (depending on the payment type you choose) to apply for the service fee
    • This field is not allowed to be empty
  • Fee Tax:

    • Choose Tax Rule to calculate the fee tax for service fee
    • Fee Tax = No: Not apply to calculate the fee tax for service fee
  • Cart Sort Order:

    • Enter the priority for displaying the rule on the frontend and in the admin order
    • The smaller the input number, the higher the display priority. For the rule with equal priority, the priority will be based on the ID.
  • Refundable:

    • Choose Yes to apply the service fee for the refund order
    • The service fee will be applied at the first refund
  • Stop further processing:

    • Choose Yes to limit the number of the rule that is applied for the service types (based on the priority and ID)

    • For example: There're 4 rules as Rule 1, Rule 2, Rule 3 and Rule 4 and the respective priority is 0, 5, 3 and 3.

      • All rules are set as `Stop further processing = No: all rules are applied
      • Edit Rule 3 and choose Stop further processing = Yes: After you Apply Ryle, the applied rules are Rule 1 (as the high priority) and Rule 3. Rule 2 (as the small priority) and Rule 4 (as creating later) are not applied.

Step 4: Enter labels for service types for the store and in the backend​
  • For Apply Type = Manual: Display the Manage Option

    • Type: Choose the service fee type

        • Fee Type = Percentage of cart total: Service fee will be calculated as percentage of total cart
      • Fee Type = Fixed amount for the whole cart: Service fee will be charged as a certain amount when the customers purchase the products
      • Fee Type = Fixed amount for each item: The service fee will be calculated as a certain amount on each item in the cart
    • Amount: Enter the amount or percentage (depending on the payment type you choose) to apply for the service fee

    • Admin:

      • Enter the display name in the admin order/invoice/shipment/credit memo for the selected service type
      • This field is not allowed to be empty
    • Stores: Enter the display name for added service type on the frontend of the stores

    • Is Default: Choose the default service type when customers choose a new service

    • New Option: Click on the New Option button to setup other services

  • For Apply Type = Automatic: Display the Manage Labels

    • Admin:
      • Enter the display name in the admin order/invoice/shipment/credit memo for selected service type
      • This field is not allowed to be empty
    • Stores: Enter the display name for selected service type on the frontend of the stores

3. Frontend​

3.1. Display on the Cart Summary​

3.2. Display on the Payment Method​

3.3. Display on the Shipping Methods​

3.4. Display on the Order​

3.5. Display on the Invoice​

3.6. Display on the Shipment​

3.7 Display on the Credit Memo​

3.8 Display on the Checkout with Multiple Addresses​

The extra fee is applied when checking out with multiple addresses in the following positions:

  • Shipping Method:

  • Payment Method:

  • Cart Summary:

4. Backend​

4.1. Order​

4.2. Invoice​

4.3. Shipment​

4.4. Credit Memo​

4.5. Order Grid​

Show the extra fee information in the order grid. Go to Sales > Orders to learn more about this information.

5. Email​

5.1. Order Email​

5.2. Invoice Email​

5.3. Shipment Email​

5.4. Credit Memo Email​

6. Compatible with Mageplaza One Step Checkout​

7. Compatible with Mageplaza PDF Invoice​

7.1. PDF Order​

7.2. PDF Invoice​

7.3. PDF Shipment​

7.4. PDF Credit Memo​

8. Compatible with PDF of Magento​

8.1. PDF Invoice​

8.2. PDF Shipment​

8.3. PDF Credit Memo​

9. How to custom using the layout handle​

  • To display Extra Fee in Magento's default email, you need to visit Marketing > Communications > Email Templates. You can create a new template for order, invoice, shipment, credit memo, etc. Use different code for each template to display Extra Fee data (do the same for PDF Invoice templates). Note: If there is extra fee data, this data will be displayed and vice versa, if there is no data, this template will be the same as normal Magento template.
    • Order, Shipment
      • Get Extra Fee information at Payment Method.
{{if order.getHasBillingExtraFee()}}
{{layout handle="mp_billing_extra_fee" order_id=$order_id area="frontend"}}
{{/if}}

  • Get Extra Fee information at Shipping Method.
{{if order.getHasBillingExtraFee()}}
{{layout handle="mp_billing_extra_fee" order_id=$order_id area="frontend"}}
{{/if}}

  • Get Extra Fee information at Cart Summary. Note: The rules with Apply Type = Automatic will also appear in Cart Summary in the backend and display on the template.
{{if order.getHasExtraFee()}}
<h3>{{trans "Extra Fee"}}</h3>
{{layout handle="mp_extra_fee" order_id=$order_id area="frontend"}}
{{/if}}

  • Invoice
    • Get Extra Fee information at Payment Method:
{{if invoice.getHasBillingExtraFee()}}
{{layout handle="mp_billing_extra_fee" order_id=$order_id area="frontend" invoice_id=$invoice_id}}
{{/if}}

  • Get Extra Fee information at Shipping Method
{{if invoice.getHasShippingExtraFee()}}
{{layout handle="mp_shipping_extra_fee" order_id=$order_id area="frontend" invoice_id=$invoice_id}}
{{/if}}

  • Get Extra Fee information at Cart Summary. Note: The rules with Apply Type = Automatic will also appear in Cart Summary in the backend and display on the template.
{{if invoice.getHasExtraFee()}}
<h3>{{trans "Extra Fee"}}</h3>
{{layout handle="mp_extra_fee" order_id=$order_id area="frontend" invoice_id=$invoice_id}}
{{/if}}

  • Credit Memo:
    • Get Extra Fee information at Payment Method
{{if creditmemo.getHasBillingExtraFee()}}
{{layout handle="mp_billing_extra_fee" order_id=$order_id area="frontend" creditmemo_id=$creditmemo_id}}
{{/if}}

  • Get Extra Fee informaiton at Shipping Method
{{if creditmemo.getHasShippingExtraFee()}}
{{layout handle="mp_shipping_extra_fee" order_id=$order_id area="frontend" creditmemo_id=$creditmemo_id}}
{{/if}}

  • Get Extra Fee information at Cart Summary. Note: The rules with Apply Type = Automatic will also appear in Cart Summary in the backend and display on the template.
{{if creditmemo.getHasExtraFee()}}
<h3>{{trans "Extra Fee"}}</h3>
{{layout handle="mp_extra_fee" order_id=$order_id area="frontend" creditmemo_id=$creditmemo_id}}
{{/if}}

Note:

  • You can view the template of PDF Order when it is compatible with Extra Fee extension here
  • For Invoice and Credit Memo, all fees of Extra Fee will be added to Invoice or Credit Memo first.

10. API​

Extra Fee extension by Mageplaza supports using Rest API to get extra fee data rules, collect total for customers or guest customers.

Please view details here.

Guide on how to create Integration tokens here.

11. GraphQL​

Run the following command in Magento 2 root folder:

composer require mageplaza/module-extra-fee

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

Extra Fee extension by Mageplaza supports getting data of Extra Fee rule and extra information in order with positions such as: payment method, shipping address, cart summary.

To start working wwith Extra Fee GraphQL in Magento, you neeed to:

  • Usse Magento 2.3.x orr 2.4.x. Take site to the developer mode.
  • Learn morre about GraphQL requests wwe support here