Skip to content

Instantly share code, notes, and snippets.

@bryceleue
bryceleue / recursive_copy_files.php
Last active January 28, 2020 04:02 — forked from gserrano/recursive_copy_files.php
PHP Recursive copy files
/*
* This function copy $source directory and all files
* and sub directories to $destination folder
*/
function recursive_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
@bryceleue
bryceleue / functions.php
Created June 11, 2019 18:40 — forked from mikejolley/functions.php
WooCommerce Disable guest checkout for certain products
<?php
// Code goes in theme functions.php or a custom plugin
add_filter( 'pre_option_woocommerce_enable_guest_checkout', 'conditional_guest_checkout_based_on_product' );
function conditional_guest_checkout_based_on_product( $value ) {
$restrict_ids = array( 1, 2, 3 ); // Replace with product ids which cannot use guest checkout
if ( WC()->cart ) {
$cart = WC()->cart->get_cart();