Skip to content

Instantly share code, notes, and snippets.

@nielslange
Last active July 18, 2023 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nielslange/f0a80d007fcb9ca99449ce1dacdd476d to your computer and use it in GitHub Desktop.
Save nielslange/f0a80d007fcb9ca99449ce1dacdd476d to your computer and use it in GitHub Desktop.
Snackbar notices » showApplyCouponNotice
const { registerCheckoutFilters } = window.wc.blocksCheckout;
// Prevent a couponCode called '10off' from creating a notice when it gets applied.
registerCheckoutFilters( 'example-extension', {
showApplyCouponNotice: ( value, extensions, { couponCode } ) => {
return couponCode === '10off' ? false : value;
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment