lucaspalencia
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [Plugin: Woocommerce] Custom orderUpdate to woocommerce 2.2 and:
<?php /** * Create custom order **/ function create_custom_order($orderid) { $origin_order = new WC_Order($orderid); //create order args $args = array( 'status' => 'on-hold', ); //order address $address = array( 'first_name' => $origin_order->billing_first_name, 'email' => $origin_order->billing_email, 'phone' => $origin_order->billing_phone, 'address_1' => $origin_order->billing_address_1, 'city' => $origin_order->billing_city, 'state' => $origin_order->billing_state, 'postcode' => $origin_order->billing_postcode, 'country' => 'BR' ); //plan by user $plan = $origin_order->billing_plano; //order date $origin_date = $origin_order->post->post_date; //create order repeater for ($i=0; $i < $plan; $i++) { //create new order $order = wc_create_order($args); //new date $new_date = date('Y-m-d H:i:s',strtotime($origin_date . '+'. $i .' months')); $custom_date = array( 'ID' => $order->id, 'post_date' => $new_date ); //get items origin order $orderitems = $origin_order->get_items(); //new order add products foreach ($orderitems as $item ) { $productitem = apply_filters( 'woocommerce_order_item_product', $origin_order->get_product_from_item( $item ), $item ); $idproduct = $productitem->parent->id; $order->add_product( get_product( ''.$idproduct.'' ), $item['qty'] ); } //update new order address $order->set_address( $address, 'billing' ); //update new order shipping $order->calculate_shipping(); //update new order totals $order->calculate_totals(); //update new order date wp_update_post($custom_date); } } ?>
Forum: Plugins
In reply to: [Facebook All] Users unable to log inSame problem here. I have been using for my woocommerce’s projects but now, after popup opens, the popup redirect to homepage with url: mysite.com.br/?code=AQ…
Viewing 2 replies - 1 through 2 (of 2 total)