Skip to content

Instantly share code, notes, and snippets.

@nielslange
Last active July 18, 2023 16:58
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/6da2b19b8075f9429c26777d4539b7af to your computer and use it in GitHub Desktop.
Save nielslange/6da2b19b8075f9429c26777d4539b7af to your computer and use it in GitHub Desktop.
Cart Line Items filter » showRemoveItemLink
const { registerCheckoutFilters } = window.wc.blocksCheckout;
// Show remove item link of the cart line items.
registerCheckoutFilters( 'example-extension', {
showRemoveItemLink: ( value, extensions, args ) => {
// Return early since this filter is not being applied in the Cart context.
// We must return the original value we received here.
if ( args?.context !== 'cart' ) {
return value;
}
return false;
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment