CouponService

This service class contains functions related to coupons in the basket.
All public functions are available in the Twig template renderer.

Namespace

IO\Services

Constants
Type Name Value Description

int

BELOW_MINIMAL_ORDER_VALUE

301

int

NO_VALID_ITEM_IN_BASKET

302

Properties
Type Name Description

CouponCampaignRepositoryContract

$couponCampaignRepository

BasketRepositoryContract

$basketRepository

VariationCategoryRepositoryContract

$variationCategoryRepository

AuthHelper

$authHelper

Methods
public __construct($couponCampaignRepository, $basketRepository, $variationCategoryRepository, $authHelper)

CouponService constructor.

Parameters

Type

Name

Description

CouponCampaignRepositoryContract

$couponCampaignRepository

BasketRepositoryContract

$basketRepository

VariationCategoryRepositoryContract

$variationCategoryRepository

AuthHelper

$authHelper

public setCoupon($couponCode):Basket

Setter for couponCode

Parameters

Type

Name

Description

string

$couponCode

Code representing a coupon

public removeCoupon($code = null):Basket

Remove the coupon code from the basket and optionally throw a notification with a code.

Parameters

Type

Name

Description

int

$code

Optional: Error code for notification

public checkCoupon($basket):array

Get a basket with applied coupon discounts

Parameters

Type

Name

Description

array

$basket

The basket

public validateBasketItemDelete($basket, $basketItem)
Deprecated!

since 5.0.9. Validation is handled b the plentymarkets core from now.

Validate the basket for the coupon, and remove the coupon if invalid

Parameters

Type

Name

Description

Basket

$basket

The basket

array

$basketItem

Current basketItem

public validateBasketItemUpdate($basket, $data, $basketItem)
Deprecated!

since 5.0.9. Validation is handled b the plentymarkets core from now.

Validate the basket for the coupon, and remove the coupon if invalid

Parameters

Type

Name

Description

Basket

$basket

The Basket

array

$data

New basketItem

array

$basketItem

Current basketItem

public effectsOnShippingCosts($campaign):bool

Checks, if the coupon's discount changes shipping costs.

Parameters

Type

Name

Description

CouponCampaign

$campaign

Contains information about the campaign