Cart Discounts - Filter Hook References

Modified on Sat, 19 Nov, 2022 at 8:40 PM

This is simply a list of cart discount-related filter hooks that can be found within the WooCommerce Partial COD - Payment Gateway Restrictions & Fees files. This list also includes the supported parameters and example codes.


woopcd_partialcod/discount-title

  • Parameters:
  • $discount_title string
  • $discount_key string
  • $discount array()


Example Codes:

function custom_discount_title( $discount_title, $discount_key, $discount ) {

    //add your custom code here
    return $discount_title;
}

add_filter( 'woopcd_partialcod/discount-title', 'custom_discount_title', 10, 3 );

woopcd_partialcod/discount-amount

  • Parameters:
  • $discount_amount numeric
  • $discount_key string
  • $discount array()


Example Codes:

function custom_discount_amount( $discount_amount, $discount_key, $discount ) {

    //add your custom code here
    return $discount_amount;
}

add_filter( 'woopcd_partialcod/discount-amount', 'custom_discount_amount', 10, 3 );

woopcd_partialcod/discount-amount-taxes

  • Parameters:
  • $discount_taxes array()
  • $discount_key string
  • $discount array()


Example Codes:

function custom_discount_amount_taxes( $discount_taxes, $discount_key, $discount ) {

    //add your custom code here
    return $discount_taxes;
}

add_filter( 'woopcd_partialcod/discount-amount-taxes', 'custom_discount_amount_taxes', 10, 3 );

woopcd_partialcod/discount-amount-tax

  • Parameters:
  • $discount_amount_tax numeric
  • $discount_key string
  • $discount array()


Example Codes:

function custom_discount_amount_tax( $discount_amount_tax, $discount_key, $discount ) {

    //add your custom code here
    return $discount_amount_tax;
}

add_filter( 'woopcd_partialcod/discount-amount-tax', 'custom_discount_amount_tax', 10, 3 );

woopcd_partialcod/discount-desc

  • Parameters:
  • $discount_desc string
  • $discount_key string
  • $discount array()


Example Codes:

function custom_discount_desc( $discount_desc, $discount_key, $discount ) {

    //add your custom code here
    return $discount_desc;
}

add_filter( 'woopcd_partialcod/discount-desc', 'custom_discount_desc', 10, 3 );

woopcd_partialcod/discount-coupon-amount

  • Parameters:
  • $discount_coupon_amount numeric
  • $coupon_code string
  • $discount_key string
  • $discount array()


Example Codes:

function custom_discount_coupon_amount( $discount_coupon_amount, $coupon_code, $discount_key, $discount ) {

    //add your custom code here
    return $discount_coupon_amount;
}

add_filter( 'woopcd_partialcod/discount-coupon-amount', 'custom_discount_coupon_amount', 10, 4 );

woopcd_partialcod/discount-coupon-title

  • Parameters:
  • $discount_coupon_title string
  • $coupon_code string
  • $discount_key string
  • $discount array()


Example Codes:

function custom_discount_coupon_title( $discount_coupon_title, $coupon_code, $discount_key, $discount ) {

    //add your custom code here
    return $discount_coupon_title;
}

add_filter( 'woopcd_partialcod/discount-coupon-title', 'custom_discount_coupon_title', 10, 4 );

woopcd_partialcod/discount-coupon-desc

  • Parameters:
  • $discount_coupon_title string
  • $coupon_code string
  • $discount_key string
  • $discount array()


Example Codes:

function custom_discount_coupon_desc( $discount_coupon_desc, $coupon_code, $discount_key, $discount ) {

    //add your custom code here
    return $discount_coupon_desc;
}

add_filter( 'woopcd_partialcod/discount-coupon-desc', 'custom_discount_coupon_desc', 10, 4 );


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article