Searched all over and cant find any information so wondered if anyone here has any knowledge or can help?
What I’m trying to do is when a customer makes there first order on the site it will backup the current items in their cart to a wishlist and replace with a measure to be sent out instead to get customer sizes.
Then once they know their measurements they can input them and pickup the order from their wishlist. Managed to get everything working apart from the wishlists as cant find any docs.
function first_time_order() {
global $current_user;
get_currentuserinfo();
$userID = $current_user->ID;
$orders = get_user_meta($userID, '_number_orders', true);
if ( $orders == 0 ) {
// Get cart
global $woocommerce;
foreach($woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$_product = $values['data'];
$cart_items .= $_product->id . ', ';
}
// create First Order wishlist and add cart items.
// empty cart
$woocommerce->cart->empty_cart();
// add measure
$measure_id = '97';
$woocommerce->cart->add_to_cart( $measure_id );
// Apply coupon code?
$coupon_code = 'FREEMEASURE';
$woocommerce->cart->add_discount( $coupon_code );
} else {
}
}
Using the official woocommerce wishlists plugin but cant find any information on how to create list with php here’s my code so far.