Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created March 21, 2019 14:04
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 djrmom/be55929c2839041e8c14a9cedff01b23 to your computer and use it in GitHub Desktop.
Save djrmom/be55929c2839041e8c14a9cedff01b23 to your computer and use it in GitHub Desktop.
facetwp out price html rather than just price for woocommerce in layout builder
<?php
/** replace woocommerce "price" in layout builder with price/sale price html **/
add_filter( 'facetwp_builder_item_value', function( $value, $item ) {
if ( 'woo/price' == $item['source'] ) {
$product = wc_get_product( get_the_ID() );
$value = $product->get_price_html();
}
return $value;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment