This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--primary-color: #35c287; | |
--primary-color-opaque: #35c287 40; | |
--primary-color-light: #35c287 80; | |
} | |
html a, html .button.is-ghost, html .button.is-ghost:hover, html .button.is-ghost.is-hovered, html .breadcrumb a, html .menu-list a.is-active, html .panel-list a:hover, html .panel-block.is-active .panel-icon, html .navbar-item.is-tab.is-active, html .carousel-arrow .icon, html .copy-text:hover, html .autocomplete a.dropdown-item:hover, html .autocomplete .dropdown .dropdown-menu .has-link a:hover, html .dropdown .dropdown-menu .has-link .autocomplete a:hover, html .autocomplete a.dropdown-item.is-hovered, html .autocomplete .dropdown .dropdown-menu .has-link a.is-hovered, html .dropdown .dropdown-menu .has-link .autocomplete a.is-hovered, html section.lists .view:hover, html .log-view .lines .timestamp, html a.navbar-item:focus, html a.navbar-item:focus-within, html a.navbar-item:hover, html a.navbar-item.is-active, html .navbar-link:focus, html .navbar-link:focus-within, html .navbar-link:hover, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Save coorindates of the billing address when order marked completed using google geocode API and save it to order meta | |
add_action('woocommerce_order_status_completed', function($order_id) { | |
$order = wc_get_order($order_id); | |
$billing_address = $order->get_formatted_billing_address(); | |
// Replace spaces with '+' for URL encoding | |
$formatted_address = str_replace(' ', '+', $billing_address); | |
$api_key = 'YOUR GOOGLE API KEY'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: shipping-cache-test-block | |
Version: 1.0 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('woocommerce_validate_postcode', function($valid, $postcode, $country){ | |
if($country != 'HU') return $valid; | |
$postcode = intval($postcode); | |
$valid_postcodes = array(1007, 1011, 1012, 1013, 1014, 1015, 1016, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1051, 1052, 1053, 1054, 1055, 1056, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1121, 1122, 1123, 1124, 1125, 1126, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1161, 1162, 1163, 1164, 1165, 1171, 1172, 1173, 1174, 1181, 1182, 1183, 1184, 1185, 1186, 1188, 1191, 11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Environment(\.colorScheme) var colorScheme | |
Form { | |
ZStack(alignment:.bottomLeading) { | |
Text("Custom Shortcuts Button") | |
HStack(spacing:0) { | |
ShortcutsLink().shortcutsLinkStyle((colorScheme == .dark) ? .dark : .light).frame(height: 20).opacity(0.011) | |
ShortcutsLink().shortcutsLinkStyle((colorScheme == .dark) ? .dark : .light).frame(height: 20).opacity(0.011) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create search bar on the top of the my account / orders page | |
add_action('woocommerce_before_account_orders', function(){ | |
?> | |
<form method="get"> | |
<input type="text" name="keyword" placeholder="Keresés" value="<?php echo esc_attr($_GET['keyword']); ?>"> | |
<input type="submit" value="Keresés" /> | |
</form> | |
<?php | |
$customer_orders = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_shortcode( 'add-to-cart-form', function($atts) { | |
global $post; | |
//Get shortcode attributes | |
$a = shortcode_atts( array( | |
'id' => 0 | |
), $atts ); | |
//Find the product and set it to global | |
$product_data = get_post( $a['id'] ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Theres is a guide here to do this properly: https://developer.woocommerce.com/2021/03/17/adding-your-own-store-management-links/ | |
//Since my extension is not a javascript project, it was easier just to insert the link without the need to import the additional wordpress libraries to my project | |
if(window.location.search.indexOf('page=wc-admin') > -1) { | |
var waitForEl = function(selector, callback) { | |
if (!jQuery(selector).size()) { | |
setTimeout(function() { | |
window.requestAnimationFrame(function(){ waitForEl(selector, callback) }); | |
}, 100); | |
}else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'manage_edit-shop_order_columns', function($columns) { | |
$columns['order_info'] = 'Rendelés infók'; | |
return $columns; | |
}); | |
add_action( 'manage_shop_order_posts_custom_column', function( $column ) { | |
global $the_order; | |
if ( 'order_info' === $column ) { | |
echo $the_order->get_billing_email(); | |
$line_items = $the_order->get_items(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
I built custom product pages with a simple add to cart button(using the add_to_cart shortcode) for a webshop. | |
There was no need for category pages, shop pages, cart or anything like that, just a simple product page with an add to cart button that redirects to checkout directly. | |
Here is how you can do this: | |
1. Delete the My Account page | |
2. Delete the Shop page | |
*/ |
NewerOlder