oxid-esales/freeshipping-coupons-module

v1.1.0 2025-06-11 11:51 UTC

This package is not auto-updated.

Last update: 2025-06-17 19:21:36 UTC


README

Development Latest Version PHP Version

Quality Gate Status Coverage Technical Debt

This module introduces a new coupon type, shipfree, designed to balance shipping costs to zero for eligible orders. When applied, this coupon calculates its value based on the current basket’s shipping cost, effectively covering all shipping fees for the user.

Branch compatibility

  • 1.1.x versions (or b-7.3.x branch) are compatible with OXID eShop compilation b-7.3.x
  • 1.0.x versions (or b-7.2.x branch) are compatible with OXID eShop compilation b-7.2.x

Installation

  1. Run the following command to install the latest version of this module:
composer require oxid-esales/freeshipping-coupons-module ^1.1
  1. Before activating the module, make sure you run migrations first
vendor/bin/oe-eshop-doctrine_migration migrations:migrate oe_freeshipping
  1. Activate the module through the admin interface or command line:
vendor/bin/oe-console oe:module:activate oe_freeshipping

Development installation on OXID eShop SDK

The installation instructions below are shown for the current SDK for shop 7.3. Make sure your system meets the requirements of the SDK.

  1. Ensure all docker containers are down to avoid port conflicts

  2. Clone the SDK for the new project

echo MyProject && git clone https://github.com/OXID-eSales/docker-eshop-sdk.git $_ && cd $_
  1. Clone the repository to the source directory
git clone --recurse-submodules https://github.com/OXID-eSales/freeshipping-coupons-module.git --branch=b-7.3.x ./source
  1. Run the recipe to setup the development environment
./source/recipes/setup-development.sh

You should be able to access the shop with http://localhost.local and the admin panel with http://localhost.local/admin (credentials: noreply@oxid-esales.com / admin)

Usage

Configuration:

  • Navigate to Shop Settings → Coupon Series → Main.
  • Under Discount, select the shipfree to enable shipping cost compensation on orders.
  • Configure the remaining coupon settings as desired.

Image alt

Usage Notes:

  • Zero-value vouchers appear in the cart to ensure shipfree coupons are calculated during checkout.
  • If no delivery fees apply, users will see the error, “The voucher might be wasted if not applied to an order with delivery fees.”

Testing & Limitations:

  • Ensure that shipping settings are configured.
  • Only one shipfree coupon is allowed per basket.

Order confirmation emails

In order to properly display the free shipping voucher value in order confirmation email, you need to change the templates named order_cust.html.twig and order_owner.html.twig to display the free shipping coupons value and shown in the example below.

    {% for voucher in order.getVoucherList() %}
        {% set voucherseries = voucher.getSerie() %}
        <tr valign="top" bgcolor="#ebebeb">
            <td align="right" colspan="{{ iFooterColspan }}" class="odd text-right">{{ voucher.oxvouchers__oxvouchernr.value }}</td>
            <td align="right" class="odd text-right">
                {% if voucherseries.oxvoucherseries__oxdiscounttype.value == "absolute" %}
                  {{ format_price(voucherseries.oxvoucherseries__oxdiscount.value , { currency: currency }) }}
                {% elseif voucherseries.oxvoucherseries__oxdiscounttype.value == "percentage" %}
                  {{ voucherseries.oxvoucherseries__oxdiscount.value }}%
                {% elseif voucherseries.oxvoucherseries__oxdiscounttype.value == "shipfree" %}
                  {{ format_price(voucher.oxvouchers__oxdiscount.value , { currency: currency }) }}
                {% endif %}
            </td>
        </tr>
    {% endfor %}
```bash


## Testing
### Linting, syntax check, static analysis

```bash
$ composer update
$ composer static

Unit/Integration/Acceptance tests

  • Install this module in a running OXID eShop
  • Reset the shop's database
bin/oe-console oe:database:reset --db-host=db-host --db-port=db-port --db-name=db-name --db-user=db-user --db-password=db-password --force
  • Run all the tests
composer tests-all
  • Or the desired suite
composer tests-unit
composer tests-integration
composer tests-codeception