// Add custom Theme Functions here require(__DIR__ . '/assets/functions/custom-outsole.php'); // ----- Add custom column to orders that shows which products were ordered ----- function ec_order_items_column($columns) { $columns['ordered_products'] = __('Ordered Products', 'woo-custom-ec'); // Directly insert new column after order date return $columns; } add_filter('manage_edit-shop_order_columns', 'ec_order_items_column', 99); // ----- Populate the custom column with product data ----- function ec_order_items_column_cnt($column) { global $the_order; if ($column === 'ordered_products') { $order_items = $the_order->get_items(); foreach ($order_items as $item_id => $item) { // Get thumbnail and display it $thumbnail_url = get_the_post_thumbnail_url($item->get_product_id(), 'thumbnail'); if ($thumbnail_url) { echo ''; } echo $item->get_quantity() . ' × ' . esc_html($item->get_name()) . '
'; display_custom_product_data($item); } } } add_action('manage_shop_order_posts_custom_column', 'ec_order_items_column_cnt', 99); // ----- Display custom product data based on provided groups and fields ----- function display_custom_product_data($item) { $product_extras = $item->get_meta('product_extras'); $groups = [ '327275320' => ['327275357', '327275358'], '327275385' => ['327275388', '327275389'] ]; foreach ($groups as $group_key => $fields) { foreach ($fields as $field_key) { if (!empty($product_extras['groups'][$group_key][$field_key])) { echo esc_html($product_extras['groups'][$group_key][$field_key]['label']) . ': ' . esc_html($product_extras['groups'][$group_key][$field_key]['value']) . ' 

'; break 2; } } } } // ----- Maximize discount by switching coupons when limit is reached ----- function coupon_discount_max_switch($cart_obj) { if (is_admin() && !defined('DOING_AJAX')) return; $coupon_20_percent = 'AIRMAXDAY20'; $coupon_200_fixed = 'AIRMAXDAY200'; $limit = 200; // Limit without VAT $total_discount = $cart_obj->get_cart_discount_total(); if ($cart_obj->has_discount($coupon_20_percent) && $total_discount >= $limit) { $cart_obj->remove_coupon($coupon_20_percent); if (!$cart_obj->has_discount($coupon_200_fixed)) { $cart_obj->add_discount($coupon_200_fixed); } } } add_action('woocommerce_calculate_totals', 'coupon_discount_max_switch', 10); // ----- Remove Custom Fields meta box from the Post edit screen ----- function remove_post_custom_fields() { $post_types = get_post_types('', 'names'); foreach ($post_types as $post_type) { remove_meta_box('postcustom', $post_type, 'normal'); } } add_action('admin_menu', 'remove_post_custom_fields'); // ----- Hide specific menu items in the WordPress admin for the shop manager role ----- function hide_menus_for_shop_manager() { if (current_user_can('manage_woocommerce')) { $hidden_menus = [ 'grw', 'wcj-dashboard', 'edit.php?post_type=swp_forms', 'virtual-reviews', 'qlwapp' ]; foreach ($hidden_menus as $menu_slug) { remove_menu_page($menu_slug); } } } add_action('admin_menu', 'hide_menus_for_shop_manager', 100); // ----- Customize the options in WooCommerce product sorting dropdown ----- function my_woocommerce_catalog_orderby($orderby) { unset($orderby["rating"]); // Remove "Sort by average rating" return $orderby; } add_filter("woocommerce_catalog_orderby", "my_woocommerce_catalog_orderby", 20); 1.0Outsolehttps://www.outsole.nlonlinehttps://www.outsole.nl/author/frank/Nike Air Max 1 Patta Waves Blackrich600338<blockquote class="wp-embedded-content" data-secret="otlh39mC1f"><a href="https://www.outsole.nl/sneakers/nike/air-max-1/nike-air-max-1-patta-wave-black/">Nike Air Max 1 Patta Waves Black</a></blockquote><iframe sandbox="allow-scripts" security="restricted" src="https://www.outsole.nl/sneakers/nike/air-max-1/nike-air-max-1-patta-wave-black/embed/#?secret=otlh39mC1f" width="600" height="338" title="“Nike Air Max 1 Patta Waves Black” — Outsole" data-secret="otlh39mC1f" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe><script type="text/javascript"> /* <![CDATA[ */ /*! This file is auto-generated */ !function(d,l){"use strict";l.querySelector&&d.addEventListener&&"undefined"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!/[^a-zA-Z0-9]/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),o=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),c=new RegExp("^https?:$","i"),i=0;i<o.length;i++)o[i].style.display="none";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute("style"),"height"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):"link"===t.message&&(r=new URL(s.getAttribute("src")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",function(){for(var e,t,s=l.querySelectorAll("iframe.wp-embedded-content"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute("data-secret"))||(t=Math.random().toString(36).substring(2,12),e.src+="#?secret="+t,e.setAttribute("data-secret",t)),e.contentWindow.postMessage({message:"ready",secret:t},"*")},!1)))}(window,document); /* ]]> */ </script> https://www.outsole.nl/wp-content/uploads/2024/01/Nike-Air-Max-1-Patta-Wave-Black-1.jpg600400