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 item name of the order summary items. | |
registerCheckoutFilters( 'example-extension', { | |
itemName: ( 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; | |
} |
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; | |
// 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; | |
} | |
} ); |
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 the total label. | |
registerCheckoutFilters( 'example-extension', { | |
totalLabel: () => 'Deposit due today' | |
} ); |
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; | |
// Prevent a couponCode called '10off' from creating a notice when it gets removed. | |
registerCheckoutFilters( 'example-extension', { | |
showRemoveCouponNotice: ( value, extensions, { couponCode } ) => { | |
return couponCode === '10off' ? false : value; | |
} | |
} ); |
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 the subtotal price format. | |
registerCheckoutFilters( 'example-extension', { | |
subtotalPriceFormat: ( 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; | |
} |
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 item name of the cart line items. | |
registerCheckoutFilters( 'example-extension', { | |
itemName: ( 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; | |
} |
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 cart item price of the cart line items. | |
registerCheckoutFilters( 'example-extension', { | |
cartItemPrice: ( 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; | |
} |
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 cart item class of the cart line items. | |
registerCheckoutFilters( 'example-extension', { | |
cartItemClass: ( 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; | |
} |
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; | |
// 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; | |
} |
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; | |
} |