Skip to content

Instantly share code, notes, and snippets.

@danielbitzer
Created January 6, 2021 06:27
Show Gist options
  • Save danielbitzer/a38effdbbfc89aea7e878c4cafad5f89 to your computer and use it in GitHub Desktop.
Save danielbitzer/a38effdbbfc89aea7e878c4cafad5f89 to your computer and use it in GitHub Desktop.
AutomateWoo: Make generated coupon descriptions match the template coupon
<?php
/**
* AutomateWoo: Make generated coupon descriptions match the template coupon.
*
* Requires AutomateWoo 5.2.
*/
add_action(
'automatewoo/coupon_generator/generate_from_template_coupon',
function ( $coupon, $template_coupon ) {
/**
* @var \WC_Coupon $coupon The newly generated coupon object.
* @var \WC_Coupon $template_coupon The template coupon object.
*/
$coupon->set_description( $template_coupon->get_description() );
},
10,
2
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment