Skip to content

Instantly share code, notes, and snippets.

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

Eduard “RwkY” Doloc rwkyyy

🏠
Working from home
View GitHub Profile
@rwkyyy
rwkyyy / file.csv
Created January 10, 2024 11:42
WooCommerce VAT TAX configuration for EU countries
Cod țară Cod județ Cod poștal Localitate Cotă % Nume taxă Prioritate Compusă Livrare Clasă de impozitare
AT 20.0000 TVA 1 0 1
BE 21.0000 TVA 1 0 1
BG 20.0000 TVA 1 0 1
CY 19.0000 TVA 1 0 1
CZ 21.0000 TVA 1 0 1
DE 19.0000 TVA 1 0 1
DK 25.0000 TVA 1 0 1
EE 20.0000 TVA 1 0 1
ES 21.0000 TVA 1 0 1
@rwkyyy
rwkyyy / functions.php
Created February 26, 2024 19:09
ascunde alte metode când e transport gratuit + lasă sameday (și ridicare locală)
function hide_shipping_when_free_is_available( $rates, $package ) {
$new_rates = array();
$free_shipping_available = false;
foreach ( $rates as $rate_id => $rate ) {
if ( 'free_shipping' === $rate->method_id ) {
$new_rates[ $rate_id ] = $rate;
$free_shipping_available = true;
}
}
@rwkyyy
rwkyyy / function.php
Created April 26, 2024 15:07
Translate each given string in any language, while importing, with WP All Import (via Google Translate) - path should be wp-content/uploads/wpallimport/functions.php
function translate_field_with_google($text, $target_language = 'ro') {
//usage
// [translate_field_with_google({title[1]}, "ro")] where title[1] is the string, and "ro" is the lang.
if (!empty($text)) {
$api_key = 'YOUR_GOOGLE_TRANSLATE_KEY_HERE';
$url = 'https://translation.googleapis.com/language/translate/v2?key=' . $api_key;
$data = array('q' => $text, 'target' => $target_language);
$options = array(
'http' => array(
@rwkyyy
rwkyyy / functions.php
Created June 21, 2024 12:10
Display stock availability for unmanaged stock in WooCommerce - Admin - Products listing.
// Add custom column to the products admin list
add_filter( 'manage_edit-product_columns', 'add_custom_stock_status_column' );
function add_custom_stock_status_column( $columns ) {
$new_columns = array();
foreach ( $columns as $key => $value ) {
$new_columns[ $key ] = $value;
if ( $key === 'sku' ) { // Move after SKU column
$new_columns['custom_stock_status'] = 'Disponibilitate';
@rwkyyy
rwkyyy / functions.php
Created February 24, 2025 15:02
Afișare Denumire Locker Sameday în Mail
<?php
//Helper first
function getLockerNameSameday( $locker_id ) {
if ( empty( $locker_id ) ) {
return 'Locker necunoscut';
}
if ( class_exists( 'SamedayCourierQueryDb' ) ) {
// Determine if it's a test environment
@rwkyyy
rwkyyy / functions.php
Created April 22, 2025 10:27
disable indexation of feed - in a SEO friendly matter
// Disable RSS Feeds
function disable_rss_feeds() {
status_header( 410 ); // 410 Gone
nocache_headers();
header( 'X-Robots-Tag: noindex, nofollow', true );
header( 'Content-Type: text/html; charset=utf-8' );
echo wp_kses_post(
__( 'Acest feed nu mai este disponibil. Vizitează <a href="' . esc_url( home_url( '/' ) ) . '">pagina principală</a>.' )