Method: Wpxf::Auxiliary::WpMarketplaceV24FileDownload#create_product

Defined in:
lib/wpxf/modules/auxiliary/file_download/wp_marketplace_v2.4_file_download.rb

#create_productObject



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/wpxf/modules/auxiliary/file_download/wp_marketplace_v2.4_file_download.rb', line 94

def create_product
  res = execute_post_request(
    url: full_uri,
    body: {
      '__product_wpmp' => @nonce,
      'post_type' => 'wpmarketplace',
      'id' => @download_id,
      'wpmp_list[base_price]' => '0',
      'wpmp_list[file][]' => remote_file
    },
    cookie: session_cookie
  )

  unless res && (res.code == 200 || res.code == 302)
    emit_error 'Failed to create dummy product'
    emit_error res.inspect, true
    return false
  end

  true
end