autoship_rest_generated_virtual_wc_coupons

(src\coupons.php) within the the autoship_qpilot_orders_update_via_rest_convert_fees_to_coupons() function. This filter can be used to adjust the virtual coupons generated from the fee lines on the rest order. Takes new coupons and the request as parameters.

Example 

if ( !empty( $type ) ){
      $new_coupons['Coupon: ' . $coupon['Code']] = autoship_generate_virtual_wc_coupon( array(
          'code'          => 'Coupon: ' . $coupon['Code'],
          'description'   => sprintf( __( 'QPilot Dynamic Coupon generated from Coupon ID #%d.', 'autoship' ), $coupon['Id'] ),
          'discount_type' => $type,
          'amount'        => $coupon['Amount']
      ));
    }
  }

  // Allow devs to hook in so that these could be converted to real coupons or modify on the fly
  $new_coupons = apply_filters( 'autoship_rest_generated_virtual_wc_coupons', $new_coupons, $request );

Still need help? Contact Us Contact Us