mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-30 11:42:22 +08:00
https://fibosearch.com/documentation/tips-tricks/details-panel-remove-price-and-add-to-cart-button/
14 lines
657 B
Text
14 lines
657 B
Text
// Remove price from products in a details panel
|
|
add_filter( 'dgwt/wcas/suggestion_details/product/html', function($html){
|
|
// Remove price
|
|
$html = preg_replace('#<div class="dgwt-wcas-pd-price">(.+?)</div>#s', '', $html);
|
|
// Remove "Add to cart" button
|
|
$html = preg_replace('#<div class="dgwt-wcas-pd-addtc js-dgwt-wcas-pd-addtc">(.+?)</form>#s', '<div>', $html);
|
|
return $html;
|
|
}, 10);
|
|
// Remove price from terms in a details panel
|
|
add_filter( 'dgwt/wcas/suggestion_details/term/html', function($html){
|
|
// Remove price
|
|
$html = preg_replace('#<div class="dgwt-wcas-tpd-price">(.+?)</div>#s', '', $html);
|
|
return $html;
|
|
}, 10);
|