Skip to content

Instantly share code, notes, and snippets.

View xandl's full-sized avatar

Alexander Herzog xandl

View GitHub Profile
@xandl
xandl / woocommerce_custom_sale_price_based_on_user_role.php
Last active February 19, 2024 13:37
WooCommerce custom sale price based on role
<?php
/**
* Put this into your functions.php of your child-theme or custom plugin
* you can create the role with wp-cli by running `wp shell` and running the command:
* add_role('merchant','Merchant',array('read' => true, 'delete_posts' => false) );
*/
/**
* Step #1: create the field used to store the new sale_price for product_variation and for products
*/
@xandl
xandl / fix-apt.sh
Last active September 11, 2019 11:42
fix /usr/lib/apt/methods/http: relocation error with PHP from ondrej on ubunut 18
#!/bin/bash
# NEVER BLINDLY COPY COMMANDS FROM THE INTERWEBS TO THE SHELL!
sudo wget http://mirrors.kernel.org/ubuntu/pool/main/libi/libidn2/libidn2-0_2.0.4-1.1build2_amd64.deb -O libidn2-0_2.0.4-1.1build2_amd64.deb
sudo dpkg -i libidn2-0_2.0.4-1.1build2_amd64.deb
sudo apt --fix-broken install
sudo apt --allow-releaseinfo-change update
sudo apt -y dist-upgrade
sudo rm -f libidn2-0_2.0.4-1.1build2_amd64.deb