Hi, i want to add a member_price custom text on shop loop, below the product price.
add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_show_sale_percentage_loop', 25 );
function bbloomer_show_sale_percentage_loop() {
global $product;
if ( $product->is_type( 'simple' ) ) {
$member_price = $product->get_regular_price() - ($product->get_regular_price() * 0.2);
} elseif ( $product->is_type( 'variable' ) ) {
$member_price = 0;
foreach ( $product->get_children() as $child_id ) {
$variation = wc_get_product( $child_id );
$price = $variation->get_regular_price();
$member_price = $price - ($price * 0.2);
}
}
echo '<div class="member-price">' . __('Member Price') . ': ' . wc_price( $member_price ) . '</div>';
}
It display fine on 2021 theme, but not displaying on xstore. do i need to make change on the theme files directly? if so which file? and it would be great if I dont need to edit the theme files directly because it will be wiped out when updated.