/** * Theme functions and definitions. * * For additional information on potential customization options, * read the developers' documentation: * * https://developers.elementor.com/docs/hello-elementor-theme/ * * @package HelloElementorChild */ if (! defined('ABSPATH')) { exit; // Exit if accessed directly. } define('HELLO_ELEMENTOR_CHILD_VERSION', '2.0.0'); /** * Load child theme scripts & styles. * * @return void */ function hello_elementor_child_scripts_styles() { wp_enqueue_style( 'hello-elementor-child-style', get_stylesheet_directory_uri() . '/style.css', [ 'hello-elementor-theme-style', ], HELLO_ELEMENTOR_CHILD_VERSION ); } add_action('wp_enqueue_scripts', 'hello_elementor_child_scripts_styles', 20); // New actions to split up cart totals and cross sell on cart page add_action('hproc_woocommerce_cart_totals', 'woocommerce_cart_totals', 10); add_action('hproc_woocommerce_cart_cross_sell', 'woocommerce_cross_sell_display'); add_action('acf/init', 'set_acf_settings'); function set_acf_settings() { acf_update_setting('enable_shortcode', true); } function custom_short_description_shortcode() { global $post; $short_description = get_the_excerpt($post->ID); $max_length = 40; // Maximalt antal tecken if (strlen($short_description) > $max_length) { $short_description = substr($short_description, 0, $max_length) . '...'; } return '
"; print_r($value); echo ""; } /* Lägger till is_reseller och is_company i get order rest api svaret */ add_filter('woocommerce_rest_prepare_shop_order_object', 'hproc_wc_rest_api_extend_order_lineitems_data', 10, 3); function hproc_wc_rest_api_extend_order_lineitems_data($response, $object, $request) { if (empty($response->data)) { return $response; } /* Plockar ut order data från svaret */ $order_data = $response->get_data(); /* Hämta user objektet via ID. customer_id finns på order objektet */ $user = get_user_by("id", $order_data["customer_id"]); /* Är user objektet tomt skickar vi false */ if (empty($user)) { $order_data["is_reseller"] = false; $order_data["is_company"] = false; $order_data["user_email"] = ""; } else { /* Plocka ut alla roller från user objektet */ $roles = $user->roles; /* Om rollerna är tom skickar vi false */ if (empty($roles) || count($roles) <= 0) { $order_data["is_reseller"] = false; $order_data["is_company"] = false; } else { $isReseller = false; $isCompany = false; /* $user->roles är en array även om man bara kan sätta 1 roll. Gör en foreach om detta ändras framöver. */ foreach ($roles as $role) { /* Om rollen börjar med b2b hanterar vi denna som ÅF roll och sätter $isReseller till true */ if (substr_compare($role, "b2b", 0, 3, true) === 0) { $isReseller = true; $isCompany = true; } if ($role == "company") { $isCompany = true; } } $order_data["is_reseller"] = $isReseller; $order_data["is_company"] = $isCompany; } $order_data["user_email"] = $user->user_email; } /* Sätter momsklass i API svaret */ $taxLines = $order_data["tax_lines"]; if (!empty($taxLines)) { $taxLinesIsUpdated = false; foreach ($taxLines as &$taxLine) { $taxLabel = $taxLine["label"]; if (empty($taxLabel)) { continue; } $taxLabelArray = explode(",", $taxLabel); if (empty($taxLabelArray) || count($taxLabelArray) != 2) { continue; } $taxCode = $taxLabelArray[1]; if (empty($taxCode) && $taxCode != 0) { continue; } $taxLine["pyramid_tax_code"] = $taxCode; if (!$taxLinesIsUpdated) { $taxLinesIsUpdated = true; } } if ($taxLinesIsUpdated) { $order_data["tax_lines"] = $taxLines; } } $lineItems = $order_data["line_items"]; if (!empty($lineItems)) { $lineItemsIsUpdated = false; foreach ($lineItems as &$lineItem) { $lineTaxItems = $lineItem["taxes"]; if (!empty($lineTaxItems)) { foreach ($lineTaxItems as &$lineTaxItem) { $lineTaxItem["pyramid_tax_code"] = searchPyramidTaxCodeById($lineTaxItem["id"], $order_data["tax_lines"]); if (!$lineItemsIsUpdated) { $lineItemsIsUpdated = true; } } } else { /** * Om vi inte har några taxlines är produkten momsfri. Vi måste endå skicka med pyramid_tax_code. * Utifrån fraktsätt (instance id) kan vi sätta rätt momskod. * */ $shippingLines = $order_data["shipping_lines"]; if (!empty($shippingLines)) { /** * Finns ingen logik för fler leveranssätt. Tar första i array'en. * */ $shippingLine = $shippingLines[0]; if (!empty($shippingLine)) { $shippingInstanceId = $shippingLine["instance_id"]; /** * Svenska instance_id */ $swedishShippingIds = ["20", "27", "28", "4", "10"]; /** * EU instance id */ $euShippingIds = ["29", "30", "21"]; /** * EXPORT instance id */ $exportShippingIds = ["31", "32", "22"]; $pyramidTaxCode = null; if (in_array($shippingInstanceId, $swedishShippingIds)) { $pyramidTaxCode = "4"; } else if (in_array($shippingInstanceId, $euShippingIds)) { $pyramidTaxCode = "9"; } else if (in_array($shippingInstanceId, $exportShippingIds)) { $pyramidTaxCode = "0"; } $lineTaxItems = [ [ "pyramid_tax_code" => $pyramidTaxCode ] ]; if (!$lineItemsIsUpdated) { $lineItemsIsUpdated = true; } } } } $lineItem["taxes"] = $lineTaxItems; } if ($lineItemsIsUpdated) { $order_data["line_items"] = $lineItems; } } $response->data = $order_data; return $response; } function searchPyramidTaxCodeById($id, $array) { foreach ($array as $key => $val) { if ($val['rate_id'] === $id) { return $val['pyramid_tax_code']; } } return null; } /** * Ändra valuta symbol */ add_filter('woocommerce_currency_symbol', 'hproc_currency_symbol', 10, 2); function hproc_currency_symbol($currency_symbol, $currency) { switch ($currency) { case "SEK": $currency_symbol = "SEK"; break; case "EUR": $currency_symbol = "EUR"; break; case "NOK": $currency_symbol = "NOK"; break; case "DKK": $currency_symbol = "DKK"; break; } return $currency_symbol; } /** * Visa SKU i cart och checkout */ add_filter('woocommerce_cart_item_name', 'hproc_sku_cart_page', 99, 3); function hproc_sku_cart_page($item_name, $cart_item, $cart_item_key) { // The WC_Product object $product = $cart_item['data']; // Get the SKU $sku = $product->get_sku(); // When sku doesn't exist if (empty($sku)) return $item_name; // Add the sku $item_name .= '
| Konto | |
| Användarnamn: | ' . $curr_username . ' |
| Orgaisationsnummer: | ' . get_field('field_67b5b586a2d06', 'user_' . $user_id) . ' |
| Faktureringsadress | |
| Förnamn: | ' . get_user_meta($user_id, 'billing_first_name', true) . ' |
| Efternamn: | ' . get_user_meta($user_id, 'billing_last_name', true) . ' |
| Företag: | ' . get_user_meta($user_id, 'billing_company', true) . ' |
| Adress 1: | ' . get_user_meta($user_id, 'billing_address_1', true) . ' |
| Adress 2: | ' . get_user_meta($user_id, 'billing_address_2', true) . ' |
| Stad: | ' . get_user_meta($user_id, 'billing_city', true) . ' |
| Postnummer: | ' . get_user_meta($user_id, 'billing_postcode', true) . ' |
| Land: | ' . get_user_meta($user_id, 'billing_country', true) . ' |
| Telefon: | ' . get_user_meta($user_id, 'billing_phone', true) . ' |
| Email: | ' . get_user_meta($user_id, 'billing_email', true) . ' |
| Leveransadress | |
| Förnamn: | ' . get_user_meta($user_id, 'shipping_first_name', true) . ' |
| Efternamn: | ' . get_user_meta($user_id, 'shipping_last_name', true) . ' |
| Företag: | ' . get_user_meta($user_id, 'shipping_company', true) . ' |
| Adress 1: | ' . get_user_meta($user_id, 'shipping_address_1', true) . ' |
| Adress 2: | ' . get_user_meta($user_id, 'shipping_address_2', true) . ' |
| Stad: | ' . get_user_meta($user_id, 'shipping_city', true) . ' |
| Postnummer: | ' . get_user_meta($user_id, 'shipping_postcode', true) . ' |
| Land: | ' . get_user_meta($user_id, 'shipping_country', true) . ' |
Untreated iron. Screw not included.
Thickness 2.5 mm, height excl. studs 86 mm, width unfolded 74 mm.
Model: Right
Suitable screw: Screw 16
TIP! Here’s how to find out if you need right or left hinges – Close and check!
A closed door with hinges visible on the right is right-hinged. Similarly, a closed door with hinges visible on the left is left-hung.
]]>Model from around 1860 to the middle of the 20th century. Typical cone-shaped spigots. Available in both left and right versions. High quality.
Height excl. knobs 66 mm, width unfolded 60 mm, Thickness 2 mm. Untreated iron.
Model: Left
Suitable screw: Screw 13
TIP! Here’s how to find out if you need right- or left-hinged hinges – Close and check! A closed door with hinges visible on the right is right-hinged. Similarly, a closed door with hinges visible on the left is left-hung.
]]>Model from around 1860 to the middle of the 20th century. Typical cone-shaped spigots. Available in both left and right versions. High quality.
Height excl. knobs 74 mm, width unfolded 60 mm, Thickness 2 mm. Untreated iron.
Model: Left
Suitable screw: Screw 13
TIP! Here’s how to find out if you need right- or left-hinged hinges – Close and check! A closed door with hinges visible on the right is right-hinged. Similarly, a closed door with hinges visible on the left is left-hung.
]]>Model from around 1860 to the middle of the 20th century. Typical cone-shaped spigots. Available in both left and right versions. High quality.
Height excl. knobs 74 mm, width unfolded 60 mm, Thickness 2 mm. Untreated iron.
Model: Right
Suitable screw: Screw 13
TIP! Here’s how to find out if you need right- or left-hinged hinges – Close and check! A closed door with hinges visible on the right is right-hinged. Similarly, a closed door with hinges visible on the left is left-hung.
]]>Model from around 1860 to the middle of the 20th century. Typical cone-shaped spigots. Available in both left and right versions. High quality.
Height excl. knobs 85 mm, width unfolded 74 mm, Thickness 2.5 mm. Untreated iron.
Model: Left
Suitable screw: Screw 16
TIP! Here’s how to find out if you need right- or left-hinged hinges – Close and check! A closed door with hinges visible on the right is right-hinged. Similarly, a closed door with hinges visible on the left is left-hung.
]]>Model from around 1880-1920s. Acorn-shaped spigots typical of the period. Available in both left and right versions. High quality.
Height excl. knobs 98 mm, width unfolded 106 mm, thickness 2.5 mm. Untreated iron.
Model: Left
Suitable screw: Screw 16
TIP! Here’s how to find out if you need right- or left-hinged hinges – Close and check! A closed door with hinges visible on the right is right-hinged. Similarly, a closed door with hinges visible on the left is left-hung.
]]>Model from around 1880-1920s. Ball-shaped spigots typical of the period. Available in both left and right versions. High quality.
Height excluding knobs 98 mm, width unfolded 86 mm, thickness 2.5 mm. Untreated iron.
Model: Left
Suitable screw: Screw 13
TIP! Here’s how to find out if you need right- or left-hinged hinges – Close and check! A closed door with hinges visible on the right is right-hinged. Similarly, a closed door with hinges visible on the left is left-hung.
]]>Model from around 1860 to the middle of the 20th century. Typical cone-shaped spigots. Available in both left and right versions. High quality.
Height excl. knobs 110 mm, width unfolded 102 mm, Thickness 3 mm. Untreated iron.
Model: Right
TIP! Here’s how to find out if you need right- or left-hinged hinges – Close and check! A closed door with hinges visible on the right is right-hinged. Similarly, a closed door with hinges visible on the right is right-hinged.
]]>Model from around 1860 to the middle of the 20th century. Typical cone-shaped spigots. Available in both left and right versions. High quality.
Height excl. knobs 110 mm, width unfolded 102 mm, Thickness 3 mm. Untreated iron.
Model: Left
TIP! Here’s how to find out if you need right- or left-hinged hinges – Close and check! A closed door with hinges visible on the right is right-hinged. Similarly, a closed door with hinges visible on the left is left-hung.
]]>Model from around 1880-1920s. Acorn-shaped spigots typical of the period. Available in both left and right versions. High quality.
Height excl. knobs 98 mm, width unfolded 106 mm, thickness 2.5 mm. Untreated iron.
Model: Right
Suitable screw: Screw 16
TIP! Here’s how to find out if you need right- or left-hinged hinges – Close and check! A closed door with hinges visible on the right is right-hinged. Similarly, a closed door with hinges visible on the left is left-hung.
]]>