Skip to content

Instantly share code, notes, and snippets.

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

Jasper Frumau jasperf

🏠
Working from home
View GitHub Profile
@jasperf
jasperf / rcWidget.js
Created May 19, 2020 04:34 — forked from milesw/rcWidget.js
rcWidget.js
import 'core-js/es6/array';
import 'core-js/es6/object';
import 'core-js/es6/string';
// Global options
import defaults from './_config';
// general helper functions
import Helper from './_helpers';
// general pricing and currency functions
import Pricing from './_pricing';
// throttle and debounce manager
@jasperf
jasperf / Configurations for Laravel app on Kubernetes - Dockerfile Deploying laravel on kubernetes cluster - Ready to use configuration Files
FROM php:7.2-fpm
COPY app /var/www/
EXPOSE 9000
@jasperf
jasperf / woocommerce-single-product-page-price-display-excl-vat-per-role.php
Last active February 26, 2020 02:38
WooCommerce Single Product Page Price Display Excl VAT per Role
/// Display Excluding VAT for role bedrijf on single product page
function edit_price_display() {
global $product;
if(is_singular('product') && is_user_logged_in() && current_user_can( 'bedrijf' )) {
$price = $product->price;
$price_excl_tax = $price + round($price / ( 21 / 100 ), 2);
$price_excl_tax = number_format($price_excl_tax, 2, ",", ".");
$price = number_format($price, 2, ",", ".");
$display_price = '<span class="price">';
@jasperf
jasperf / wp-config-debug.php
Created February 19, 2020 06:27 — forked from jrfnl/wp-config-debug.php
Code to add to wp-config.php to enhance information available for debugging.
<?php
/**
* == About this Gist ==
*
* Code to add to wp-config.php to enhance information available for debugging.
*
* You would typically add this code below the database, language and salt settings
*
* Oh.. and *do* make sure you change the path to the log file to a proper file path on your server (make sure it exists).
*
@jasperf
jasperf / role-based-min-quantity.php
Last active February 16, 2020 09:11
WooCommerce Filter on user role to display minimum quantity of products with https://wordpress.org/plugins/product-quantity-for-woocommerce/
add_filter( 'alg_wc_pq_get_product_qty_min', 'my_product_qty_min_by_user_role', 10, 2 );
function my_product_qty_min_by_user_role( $qty, $product_id ) {
$current_user = wp_get_current_user();
return ( in_array( 'bedrijf', $current_user->roles ) ? 10 : $qty );
}
@jasperf
jasperf / gist-oembed.php
Created February 14, 2020 01:20 — forked from ninnypants/gist-oembed.php
Quick WordPress plugin to add gists to oEmbed
<?php
/*
Plugin Name: Gist oEmbed
Plugin URI: http://ninnypants.com
Description: Embed gists into posts
Version: 1.0
Author: ninnypants
Author URI: http://ninnypants.com
License: GPL2
@jasperf
jasperf / Add-Custom-Fields-to-WooCommerce-Registration.php
Created February 14, 2020 01:18
Add Custom Fields to WooCommerce Registration
add_action( 'woocommerce_register_form', 'wc_extra_registation_fields' );
function wc_extra_registation_fields() {
?>
<p class="form-row form-row-first">
<label for="reg_role"><?php _e( 'Privat or commercial?', 'woocommerce' ); ?></label>
<select class="input-text" name="role" id="reg_role">
<option <?php if ( ! empty( $_POST['role'] ) && $_POST['role'] == 'customer') esc_attr_e( 'selected' ); ?> value="customer">private</option>
<option <?php if ( ! empty( $_POST['role'] ) && $_POST['role'] == 'reseller') esc_attr_e( 'selected' ); ?> value="reseller">commercial</option>
</select>
</p>
@jasperf
jasperf / registerasprivatepersonorbusiness.php
Created February 13, 2020 05:50
Register as private person or company using ACF
<?php
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_5e44e23f16db9',
'title' => 'Custom Registration',
'fields' => array(
array(
'key' => 'field_5e44e2456a4a9',
'label' => 'Particulier of Bedrijf',
<?php
/*
Plugin Name: Custom Registration Fields
Plugin URI:
Description:
Version: 0.1
Author: CSSIgniter
Author URI:
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@jasperf
jasperf / woocommerce–tax-exempt-fields.php
Last active February 11, 2020 02:43 — forked from colewinans/gist:7914695
WooCommerce – Tax Exempt Fields
/**
* Add tax exempt fields to checkout
**/
add_action('woocommerce_before_order_notes', 'taxexempt_before_order_notes');
function taxexempt_before_order_notes( $checkout ) {
woocommerce_form_field( 'tax_exempt_checkbox', array(
'type' => 'checkbox',
'class' => array('tiri taxexempt'),array( 'form-row-wide', 'address-field' ),