Site icon Hip-Hop Website Design and Development

Present sub-child classes on the custom-made store web page

Targets : Present Places (sub-districts & cities) on store web page

On the classes, i’ve created :

Then on the product attributes, i’ve additionally made :

I have already got a code snippet to customise a store web page like the next :

add_filter( 'woocommerce_loop_add_to_cart_link','displaying_product_attributes',5);

operate displaying_product_attributes() {
world $product;

 
$tipe_iklan_val = $product->get_attribute('pa_tipe-iklan');

$title_val = $product->get_title();

$harga_val = $product->get_attribute('pa_harga');

$kt_val = $product->get_attribute('pa_kt');
$km_val = $product->get_attribute('pa_km');

$luas_bangunan_val = $product->get_attribute('pa_luas-bangunan');
$luas_tanah_val = $product->get_attribute('pa_luas-tanah');

$kelurahan_val = $product->get_attribute('pa_kelurahan');
/*possibly code for sub-child classes in right here)*/
    
$sku_val = $product->get_sku();


echo "<p style='color:#000; margin-left:5px; text-align:center; font-size:16px; height:24px; border:1px solid transparent; background-color:#e4e4e4; border-radius:5px; width:fit-content; width:-moz-fit-content; font-weight:600;padding-top:3px; padding-left:10px;padding-right:10px; margin-top:5px; letter-spacing:1.1px; box-shadow: 0px 0px 4px 1.5px rgb(0 0 0 / 0.8);'>".str_replace(',',' atau', $product->get_attribute .$tipe_iklan_val)."</p>";

echo "<h2 style='font-size:16px; margin-left:5px;text-overflow: ellipsis;overflow:hidden;white-space:nowrap;'>".$title_val."</h2>"; 

echo "<p style='color:#1ebf41; text-align:left;margin-left:6px; padding-top:10px; font-size:18px;line-height:0.9; font-weight:bold'>".$harga_val."</p>";

echo "<p style='color:#333; text-align:left;margin-left:7px;font-size:14px;line-height: 0.1;'><i class='fas fa-bed'></i> &nbsp;".$kt_val."&emsp;<i class='fas fa-shower'></i> &nbsp;".$km_val."&emsp;<i class='fa fa-home'></i>&nbsp; ".$luas_bangunan_val."m<sup>2</sup>&emsp;<i class='fas fa-expand-arrows-alt'></i>&nbsp; ".$luas_tanah_val."m<sup>2</sup></p>";

echo "<p style='color:#333; text-align:left; margin-left:7px;font-size:14px;line-height: 1;'><i class='fas fa-map-marker-alt'></i>&nbsp; ".$kelurahan_val.",&nbsp;"./*$sub-child_categories_val.*/"</p>";

echo "<p style='color:#333; text-align:left;margin-left:7px; font-size:14px;line-height: 0.8;'>ID : ".$sku_val."</p>";
}

The code above has a show like this

I’ve managed to show the sub-districts taken from the product attribute with the variable identify $kelurahan.

However I appear to have reached a lifeless finish to show cities (sub-child class).

Can somebody assist me to achieve the goal?