Home Woocommerce add downloadable files by PHP
Reply: 0

Woocommerce add downloadable files by PHP

mathvc_ Published in 2018-02-14 11:42:57Z

I tried to add downloadable files in Woocommerce by PHP by this code:

$pd_object = new WC_Product_Download();


$productw = wc_get_product($productw_id);

$downloadsw = $productw->get_downloads();

$downloadsw[$attachment_id] = $pd_object;

// Set the complete downloads array in the product

However, the file did not added in downloadable files in edit page of the product. Can anyone help me?

EDIT: I didn't get any error but the files wasn't added in the "downloadable files" when I tried to edit the product page. However, the "_downloadable_files" seems to be correctly edited in my database.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.312785 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO