by Garth | Jun 29, 2018 | PHP, Woocommerce, Wordpress
add_action(‘woocommerce_checkout_update_order_meta’,function( $order_id, $posted ) { $order = wc_get_order( $order_id ); $order->update_meta_data( ‘selected_date’, $_COOKIE[‘selected_date’] ); $order->save(); } , 10, 2); On...
by Garth | Jun 12, 2018 | Debugging, PHP, Wordpress
So today a client’s site that had its WordPress version updated (to 4.9.1) started throwing this error when they tried to use the Metaslider plugin to upload new images. Some searching confirmed this was happening to more than a few other people but I did not easily...
by Garth | Jun 5, 2018 | PHP, Snippets, Tools, Woocommerce, Wordpress
Send an email if there are any woocommerce orders created a before the current Day. $wp_query = new WP_Query( array( ‘posts_per_page’=> -1, ‘post_type’=>’shop_order’, ‘post_status’=>’wc-processing’,...
by Garth | Jun 5, 2018 | PHP, Snippets
function secondsToTime($seconds) { $dtF = new \DateTime(‘@0’); $dtT = new \DateTime(“@$seconds”); return $dtF->diff($dtT)->format(‘%a days, %h hours, %i minutes and %s seconds’); } echo...
by Garth | May 31, 2018 | PHP, Snippets, Wordpress
Use your discretion and adjust the function as you need it. It should make sense when you read the function. It currently sets a shipping fee based on the total cost of the cart. // ADD SHIPPING COST function woo_add_cart_fee() { if...
by Garth | May 29, 2018 | PHP, Snippets
<?php session_start(); if (!isset($_SESSION[‘splash’])) { $_SESSION[‘splash’] = “active”; echo “Session has been started”; }else { echo “Session is currently active”; // $_SESSION[‘splash’] =...