Add Custom Data to Woocommerce Order

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...

Convert Seconds to Time

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...

Woocommerce add Custom Shipping Fee

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...

PHP Start A Session and Set Session Variable

<?php session_start(); if (!isset($_SESSION[‘splash’])) { $_SESSION[‘splash’] = “active”; echo “Session has been started”; }else { echo “Session is currently active”; // $_SESSION[‘splash’] =...

Pin It on Pinterest