Skip to content

Instantly share code, notes, and snippets.

View assoscoupa's full-sized avatar
🏠
Working from home

Paris Koutroumanos assoscoupa

🏠
Working from home
View GitHub Profile
@assoscoupa
assoscoupa / WooCommerce: Remove related products when up-sell products are defined
Last active May 18, 2020 12:34 — forked from roykho/gist:1062c708af772412fe7e
WooCommerce: Remove related products when up-sell products are defined
@assoscoupa
assoscoupa / Woocommerce Make Greece GR State-County Mandatory
Last active July 8, 2024 08:47
Woocommerce Make Greece GR State/County Mandatory
/* By deafault State fields for Greece is not mandatory.
If you want to change it to mandatory, add this code snippet into function.php.
I found this solutions there: https://www.mootpoint.org/blog/woocommerce-make-uk-county-field-required/ */
add_filter( 'woocommerce_get_country_locale', 'mp_change_locale_field_defaults');
function mp_change_locale_field_defaults($countries) {
$countries['GR']['state']['required'] = true;
return $countries;
@assoscoupa
assoscoupa / Remove string from wordpress post with SQL query
Last active May 18, 2020 12:35
Remove string from wordpress post with SQL query
// Όταν θέλω να αφαιρέσω πχ το {loadposition banner_con}
// Info: https://digwp.com/2010/03/remove-replace-content-wordpress-database/
UPDATE rg_posts SET post_content = REPLACE ( post_content, '{loadposition banner_con}', '' );
@assoscoupa
assoscoupa / Woocommerce Modify States
Last active May 18, 2020 12:34
Woo Modify States - Πχ. Μετατροπή από Περιφέρειες σε Νομούς
/**
* Add or modify States https://docs.woocommerce.com/document/addmodify-states/
*/
add_filter( 'woocommerce_states', 'custom_woocommerce_states' );
function custom_woocommerce_states( $states ) {
$states['XX'] = array(
'XX1' => 'State 1',
'XX2' => 'State 2'
@assoscoupa
assoscoupa / Hide CSS class in a specific WPML language
Last active May 18, 2020 12:33
CSS Hide element from specific language WPML etc
/* Hide element from Spanish language */
.hideLang:lang(es) {display: none !important;}
This DIV will be hidden from Spanish, for instance.
1
<div class="hideLang">Hello my friend</div>
@assoscoupa
assoscoupa / Alternative Related Woocommerce Product by Attributes
Last active May 18, 2020 12:30
Alternative Related Woocommerce Product by Attributes
@assoscoupa
assoscoupa / Municipalities-Of-Greece.csv
Last active September 22, 2023 23:41
Municipalities Of Greece
Δήμος Κωδ Περιφ Ενότητας Περιφερειακή Ενότητα Κωδικός Χώρας Χώρα
Αμφιλοχίας ΑΙΤ Αιτωλοακαρνανίας GR Ελλάδα
Ακτίου-Βόνιτσας ΑΙΤ Αιτωλοακαρνανίας GR Ελλάδα
Ξηρομέρου ΑΙΤ Αιτωλοακαρνανίας GR Ελλάδα
Ιεράς Πόλεως Μεσολογγίου ΑΙΤ Αιτωλοακαρνανίας GR Ελλάδα
Αγρινίου ΑΙΤ Αιτωλοακαρνανίας GR Ελλάδα
Θέρμου ΑΙΤ Αιτωλοακαρνανίας GR Ελλάδα
Ναυπακτίας ΑΙΤ Αιτωλοακαρνανίας GR Ελλάδα
Δήμος Άργους - Μυκηνών ΑΡΓ Αργολίδας GR Ελλάδα
Ναυπλιέων ΑΡΓ Αργολίδας GR Ελλάδα
@assoscoupa
assoscoupa / Adding SKU to Woo shop page
Last active October 26, 2020 17:17
Adding SKU to Woo shop page
/* Adding SKU to shop page */
function qwerty_gr_custom_shop_item() {
global $post, $product;
/* product sku */
echo '<p>SKU: '.$product->get_sku().'</p>';
}
add_action( 'woocommerce_after_shop_loop_item', 'qwerty_gr_custom_shop_item', 5);
@assoscoupa
assoscoupa / woocommerce_admin_disabled.php
Created January 3, 2021 12:36
Disable WooCommerce Analytics
<?php
/**
* Plugin Name: Disable WooCommerce Admin
* Description: This plugin disables the new WooCommerce Admin package in WooCommerce.
* Version: 1.0
*/
add_filter( 'woocommerce_admin_disabled', '__return_true' );
@assoscoupa
assoscoupa / woocommerce_remove_address_2_field
Last active January 6, 2021 22:48
WooCommerce How To Remove Address Line 2
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
// Set address 2 to not required
add_filter('woocommerce_checkout_fields', 'unrequire_address_2_checkout_fields' );
function unrequire_address_2_checkout_fields( $fields ) {
$fields['billing']['billing_address_2']['required'] = false;
$fields['shipping']['shipping_address_2']['required'] = false;