Last active
July 18, 2023 16:58
-
-
Save nielslange/cb9ddef141d03bb177df5ac1eacf732e to your computer and use it in GitHub Desktop.
Cart Line Items filter » saleBadgePriceFormat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { registerCheckoutFilters } = window.wc.blocksCheckout; | |
// Adjust sale badge price format of the cart line items. | |
registerCheckoutFilters( 'example-extension', { | |
saleBadgePriceFormat: ( 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 '<price/> per item'; | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment