WooCommerce Code Reference

GetCoupon
in package

Table of Contents

execute()  : Coupon|null
Retrieve a coupon by ID or code.

Methods

execute()

Retrieve a coupon by ID or code.

public execute([int|null $id = null ][, string|null $code = null ]) : Coupon|null
Parameters
$id : int|null = null

The coupon ID.

$code : string|null = null

The coupon code.

Tags
throws
InvalidArgumentException

When neither or both arguments are provided.

Return values
Coupon|null