• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Please help: Replace order or delete content of Woocommerce archive or single product pages

e195

Member
Aug 24, 2019
53
14
8
This code places "price hints" after the price. I managed to delete all price hints or delete all prices totally but what I want is the price hints shown ONLY on single product pages.

I tried a lot but nothing worked.

Can anyone help?





/**
* WPBakeryVisualComposer: Price Infos after Price
*
* @since v3.8.1
* @wp-hook woocommerce_get_price_html
* @param String $price
* @param WC_Product $product
* @return String
*/
function wp_bakery_woocommerce_get_price_html( $price, $product ) {

$debug_backtrace = debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, 10 );

$has_loop_action = false;
foreach ( $debug_backtrace as $elem ) {

if ( $elem[ 'function' ] == 'woocommerce_de_price_with_tax_hint_loop' || $elem[ 'function' ] == 'woocommerce_de_price_with_tax_hint_single' || $elem[ 'function' ] == 'get_available_variation' ) {
$has_loop_action = true;
break;
} else if ( apply_filters( 'german_market_wp_bakery_price_html_exception', false, $elem[ 'function' ], $debug_backtrace ) ) {
$has_loop_action = true;
break;
}

}

foreach ( $debug_backtrace as $elem ) {

if ( $elem[ 'function' ] == 'vc_do_shortcode' ) {

ob_start();
add_filter( 'wgm_product_summary_parts', array( $this, 'theme_support_hide_gm_price_in_loop' ), 10, 3 );
echo WGM_Template::get_wgm_product_summary( $product, 'vc_do_shortcode' );
remove_filter( 'wgm_product_summary_parts', array( $this, 'theme_support_hide_gm_price_in_loop' ), 10, 3 );
$price .= ob_get_clean();
break;

} else if ( $elem[ 'function' ] == 'wp_bakery_woocommerce_get_price_html' ) {

if ( $has_loop_action ) {
return $price;
}

ob_start();
remove_filter( 'wgm_product_summary_parts', array( 'WGM_Template', 'add_product_summary_price_part' ), 0 );
echo '<div class="gm-wp_bakery_woocommerce_get_price_html">';
echo WGM_Template::get_wgm_product_summary( $product, 'wp_bakery_woocommerce_get_price_html' );
echo '</div>';
add_filter( 'wgm_product_summary_parts', array( 'WGM_Template', 'add_product_summary_price_part' ), 0, 3 );
$price .= ob_get_clean();
break;

}

}

return $price;
}
 
This code places "price hints" after the price. I managed to delete all price hints or delete all prices totally but what I want is the price hints shown ONLY on single product pages.

I tried a lot but nothing worked.

Can anyone help?





/**
* WPBakeryVisualComposer: Price Infos after Price
*
* @since v3.8.1
* @wp-hook woocommerce_get_price_html
* @param String $price
* @param WC_Product $product
* @return String
*/
function wp_bakery_woocommerce_get_price_html( $price, $product ) {

$debug_backtrace = debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, 10 );

$has_loop_action = false;
foreach ( $debug_backtrace as $elem ) {

if ( $elem[ 'function' ] == 'woocommerce_de_price_with_tax_hint_loop' || $elem[ 'function' ] == 'woocommerce_de_price_with_tax_hint_single' || $elem[ 'function' ] == 'get_available_variation' ) {
$has_loop_action = true;
break;
} else if ( apply_filters( 'german_market_wp_bakery_price_html_exception', false, $elem[ 'function' ], $debug_backtrace ) ) {
$has_loop_action = true;
break;
}

}

foreach ( $debug_backtrace as $elem ) {

if ( $elem[ 'function' ] == 'vc_do_shortcode' ) {

ob_start();
add_filter( 'wgm_product_summary_parts', array( $this, 'theme_support_hide_gm_price_in_loop' ), 10, 3 );
echo WGM_Template::get_wgm_product_summary( $product, 'vc_do_shortcode' );
remove_filter( 'wgm_product_summary_parts', array( $this, 'theme_support_hide_gm_price_in_loop' ), 10, 3 );
$price .= ob_get_clean();
break;

} else if ( $elem[ 'function' ] == 'wp_bakery_woocommerce_get_price_html' ) {

if ( $has_loop_action ) {
return $price;
}

ob_start();
remove_filter( 'wgm_product_summary_parts', array( 'WGM_Template', 'add_product_summary_price_part' ), 0 );
echo '<div class="gm-wp_bakery_woocommerce_get_price_html">';
echo WGM_Template::get_wgm_product_summary( $product, 'wp_bakery_woocommerce_get_price_html' );
echo '</div>';
add_filter( 'wgm_product_summary_parts', array( 'WGM_Template', 'add_product_summary_price_part' ), 0, 3 );
$price .= ob_get_clean();
break;

}

}

return $price;
}
Hello,

Every person that known me very well know that I hate WooCommerce. So, couldn't you simply hide which ever part of the product price you want gone? just hide the class for it.
 
  • Like
Reactions: theglassguy
I can put css : none but then it does also not show on single product page.

It seems this code and also the CSS do not distinguish between archive pages and single product page.
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock