ds2321 2015-09-22 15:06
浏览 136

Woocommerce Wishlists - 创建新的愿望清单并添加产品

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度