• wixi

    (@wixi)


    Many thanks for this time saver! I used it for 150k attributes ??
    Just one thing is missing – the variations maker from attributes (found on StackOverflow)

    var $j = jQuery.noConflict();
    var base = 'https://test.com'; //website
    var ids = [1, 2]; //product post id-s
    var securityToken = 'XXXXXXXXX'; //get the security token from cookies
    
    //recursively trigger woocommerce_link_all_variations action
    function variate(arr) {
      var id = arr.pop();
      if (typeof id === 'undefined' || !id) return;
      console.log('handling post ' + id);
      $j.ajax(base + '/wp-admin/admin-ajax.php', {
        'data': 'action=woocommerce_link_all_variations&post_id=' + id + '&security=' + securityToken,
        'type': 'POST',
        'processData': false,
        'contentType': 'application/x-www-form-urlencoded'
      }).done(function() {
        variate(arr)
      });
    }

    – run it from web browser console (F12)

    • This topic was modified 7 years ago by wixi.
    • This topic was modified 7 years ago by wixi.
  • The topic ‘It’s the best’ is closed to new replies.