shop page code question
-
I have added product attributes to the shop page with the code below but I need to change the spacing, Ideally I need less room above and below the attribute, please see screenshot https://snipboard.io/GYSi0c.jpg
add_action('woocommerce_after_shop_loop_item_title', 'display_custom_product_attributes_on_loop', 5 );
function display_custom_product_attributes_on_loop() {
global $product;
// Settings: Here below set your product attribute label names
$attributes_names = array('Från');
$attributes_data = array(); // Initializing
// Loop through product attribute settings array
foreach ( $attributes_names as $attribute_name ) {
if ( $value = $product->get_attribute($attribute_name) ) {
$attributes_data[] = $value;
}
}
if ( ! empty($attributes_data) ) {
echo '<div class="items" style="color: black; font-size: 12px;"><p>' . implode( '<br>', $attributes_data ) . '</p></div>';
}
}The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘shop page code question’ is closed to new replies.