2024
Aluflex
Extra plugin: Real Media Library, WP Sheet Editor, SolidComponents
/* Display custom meta data in order email, after the order table */
add_action('woocommerce_email_before_order_table', 'lw_add_item_meta_to_email', 10, 4);
function lw_add_item_meta_to_email($order, $sent_to_admin, $plain_text, $email) {
$items = $order->get_items();
echo '<div style="padding: 10px;">';
echo '<h2>' . __("Order summary", "seodr") . '</h2>';
echo '<div style="padding-bottom: 4px;"><strong>' . __("Product", "seodr") . ' <div style="float: right;">' . __("Quantity", "seodr") . '</strong></div></div>';
foreach ($items as $item) {
$meta_data = $item->get_meta_data();
$sku = get_post_meta($item->get_product_id(), '_sku', true); //viktigt att ange metafältsnamn med understreck framför, funkar med acf-fält med
echo '<div style="margin-top: 12px;">' . $item->get_name() . '<div style="float: right;">' . $item->get_quantity() . '</div></div>';
// get the item sku
if (empty($meta_data)) {
echo '<div>' . __("Art. no: ", "seodr") . '<strong>' . $sku . '</strong></div>';
}
foreach ($meta_data as $meta) {
if ($meta->key == 'Art. no') {
echo '<div>' . __("Art. no: ", "seodr") . '<strong>' . $meta->value . '</strong></div>';
}
}
}
echo '</div>';
}
/* ACF Field-setting: Array */
<?php $img = get_field('bild_acf');?>
/* ACF Field Group-setting: Attachment > All image formats. Field inuti Field Group är en checkbox. */
<?php $acf_field = get_field('ljusellermork', $img['ID']);?>
/* HTML */
<div id="preline" class="<?php if($acf_field==true):?>dark<?php else:?>light<?php endif;?>"></div>
/* Göm/visa submenu vid klick på menu parent */
$(".nav .menu-item-has-children").click(function () {
$(this).toggleClass("active");
$(this).siblings().removeClass("active");
});
/* Göm submenu vid klick utanför menu parent/submenu */
$(document).mouseup(function (e) {
if ($(e.target).closest(".nav .menu-item-has-children.active").length === 0) {
$(".nav .menu-item-has-children.active").removeClass("active");
}
});
/* (CSS; .menu-item-has-children.active .sub-menu{display:block} ) */