function hook_commerce_gc_product_giftcard_coupon_presave_alter in Commerce GC 7
Alter a coupon right before it is saved as a result of someone buying a giftcard product.
Parameters
EntityDrupalWrapper $coupon_wrapper: The new coupon, wrapped
EntityDrupalWrapper $line_item_wrapper: The wrapped giftcard purchase line item
1 invocation of hook_commerce_gc_product_giftcard_coupon_presave_alter()
- commerce_gc_product_line_item_generate_giftcard in modules/
commerce_gc_product/ commerce_gc_product.rules.inc
File
- modules/
commerce_gc_product/ commerce_gc_product.api.php, line 13
Code
function hook_commerce_gc_product_giftcard_coupon_presave_alter($coupon_wrapper, $line_item_wrapper) {
// Set the coupon code to a static value
$coupon_wrapper->code = 'static_code';
}