小编Joe*_*lin的帖子

以编程方式在Woocommerce中创建新订单

我正在以最难的方式在WooCommerce中以编程方式创建订单.我正在使用下面的代码并且正在创建订单但是我无法获得客户信息或产品订单项添加到订单中.创建的新订单仅作为Guest,没有项目,用户信息等.

问题似乎是,一旦创建了订单对象,它在尝试向订单添加数据时就会失败.

function create_vip_order() {

  global $woocommerce;

  $address = array(
      'first_name' => '111Joe',
      'last_name'  => 'Conlin',
      'company'    => 'Speed Society',
      'email'      => 'joe@testing.com',
      'phone'      => '760-555-1212',
      'address_1'  => '123 Main st.',
      'address_2'  => '104',
      'city'       => 'San Diego',
      'state'      => 'Ca',
      'postcode'   => '92121',
      'country'    => 'US'
  );

  // Now we create the order
  $order = wc_create_order();

  // The add_product() function below is located in /plugins/woocommerce/includes/abstracts/abstract_wc_order.php
  $order->add_product( get_product( '275962' ), 1 ); // This is an existing SIMPLE product
  $order->set_address( …
Run Code Online (Sandbox Code Playgroud)

php wordpress woocommerce

25
推荐指数
4
解决办法
3万
查看次数

jQuery不使用ng-repeat结果

我正在使用ng-repeat来构建一个使用jQuery和TB的手风琴.出于某种原因,这在硬编码时工作正常,但在ng-repeat指令内部无法触发.

我当时认为这个问题来自jQuery,而不是事后加载的绑定元素.因此,我认为不是在页面加载时加载脚本,而是在返回数据时在.success上加载函数会更好.不幸的是,我无法弄清楚如何使这项工作.

测试页面:http://staging.converge.io/test-json

控制器:

    function FetchCtrl($scope, $http, $templateCache) {
        $scope.method = 'GET';
        $scope.url = 'https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=http://www.web.com&key=AIzaSyA5_ykqZChHFiUEc6ztklj9z8i6V6g3rdc';
        $scope.key = 'AIzaSyA5_ykqZChHFiUEc6ztklj9z8i6V6g3rdc';
        $scope.strategy = 'mobile';

        $scope.fetch = function() {
            $scope.code = null;
            $scope.response = null;

            $http({method: $scope.method, url: $scope.url + '&strategy=' + $scope.strategy, cache: $templateCache}).
            success(function(data, status) {
                $scope.status = status;
                $scope.data = data;
            }).
            error(function(data, status) {
                $scope.data = data || "Request failed";
                $scope.status = status;
            });
        };

    $scope.updateModel = function(method, url) {
        $scope.method = method;
        $scope.url = …
Run Code Online (Sandbox Code Playgroud)

javascript jquery angularjs angularjs-ng-repeat angularjs-ng-click

11
推荐指数
2
解决办法
2万
查看次数