Skip to content

Instantly share code, notes, and snippets.

@nielslange
Created July 18, 2023 17:07
Show Gist options
  • Save nielslange/870d35adc9ffd229c94428b1ba46079f to your computer and use it in GitHub Desktop.
Save nielslange/870d35adc9ffd229c94428b1ba46079f to your computer and use it in GitHub Desktop.
Order Summary Items filter » cartItemPrice
const { registerCheckoutFilters } = window.wc.blocksCheckout;
// Adjust cart item price of the order summary items.
registerCheckoutFilters( 'example-extension', {
cartItemPrice: ( value, extensions, args ) => {
// Return early since this filter is not being applied in the Summary context.
// We must return the original value we received here.
if ( args?.context !== 'summary' ) {
return value;
}
return '<price/> for all items';
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment